Parsing

This page is dedicated to the documentation of the internal code of the GoMelan parser.

Type instances

Application Parser instance:

  • Pure : takes a value and returns a parser that always succeeds with that value.

  • <*> : applies a function inside a parser to a value inside a parser.

Alternative Parser instance:

  • empty : represents a parser that always fails.

  • <|> : try the first parser and, if it fails, try the second parser.

Monad Parser instance

  • Pure : already define.

  • >>= : applies a parser to a value, then applies a function to the result.

Functions and Operators

  • Operator similar to <?> for custom error messages.

  • Add error message in stack error.

Utilization

Applicative Instance Examples:

pure

<*>

Alternative Instance Examples:

empty

<|>

Monad Instance Examples:

>>=

(<?>)

Last updated

Was this helpful?