Module ParserComb

This module provides some simple parser combinators.

Author: Jan Tikovsky

Version: October 2017

Summary of exported operations:

yield :: a -> Parser b a   
(<*) :: Parser a b -> Parser a c -> Parser a b   
sequential application of two parsers keeping the result of the first one
(*>) :: Parser a b -> Parser a c -> Parser a c   
sequential application of two parsers keeping the result of the second one
(<|>) :: Parser a b -> Parser a b -> Parser a b   
alternative application of two parsers
eof :: Parser a b   
unexpected :: Show a => a -> Parser a b   
terminal :: (Eq a, Show a) => a -> Parser a ()   
many :: Parser a b -> Parser a [b]   
star operation on parsers
some :: Parser a b -> Parser a [b]   
plus operation on parsers
(<$>) :: Monad a => (b -> c) -> a b -> a c   
Apply a pure function to the result of a monadic action.
(<*>) :: Monad a => a (b -> c) -> a b -> a c   
Apply a function originating from the first monadic computation to the result of the second monadic action.

Exported datatypes:


Parser

Constructors:

  • Parser :: ([a] -> Either String ([a],b)) -> Parser a b

    Fields:

    • runParser :: ([a] -> Either String ([a],b))

Exported operations:

yield :: a -> Parser b a   

(<*) :: Parser a b -> Parser a c -> Parser a b   

sequential application of two parsers keeping the result of the first one

Further infos:
  • defined as left-associative infix operator with precedence 4

(*>) :: Parser a b -> Parser a c -> Parser a c   

sequential application of two parsers keeping the result of the second one

Further infos:
  • defined as left-associative infix operator with precedence 4

(<|>) :: Parser a b -> Parser a b -> Parser a b   

alternative application of two parsers

Further infos:
  • defined as left-associative infix operator with precedence 3

eof :: Parser a b   

unexpected :: Show a => a -> Parser a b   

terminal :: (Eq a, Show a) => a -> Parser a ()   

many :: Parser a b -> Parser a [b]   

star operation on parsers

some :: Parser a b -> Parser a [b]   

plus operation on parsers

(<$>) :: Monad a => (b -> c) -> a b -> a c   

Apply a pure function to the result of a monadic action.

Further infos:
  • defined as left-associative infix operator with precedence 4

(<*>) :: Monad a => a (b -> c) -> a b -> a c   

Apply a function originating from the first monadic computation to the result of the second monadic action.

Further infos:
  • defined as left-associative infix operator with precedence 4