Module DetParse

Summary of exported operations:

parse :: (String -> [(a,String)]) -> String -> Maybe a   
Applies a parser to a string.
failure :: String -> [(a,String)]   
A parser that always fails.
yield :: a -> String -> [(a,String)]   
A parser that consumes no input and results in the given value.
empty :: String -> [((),String)]   
A parser that consumes no input and results in the unit value.
anyChar :: String -> [(Char,String)]   
A parser that consumes an arbitrary single character.
check :: (a -> Bool) -> (String -> [(a,String)]) -> String -> [(a,String)]   
Builds a parser that succeeds if the predicate holds on the result of the original parser.
char :: Char -> String -> [((),String)]   
Builds a parser that consumes a specific character and results in the unit value.
word :: String -> String -> [((),String)]   
Builds a parser that consumes the given string and results in the unit value.
(<|>) :: (String -> [(a,String)]) -> (String -> [(a,String)]) -> String -> [(a,String)]   
Builds a parser that tries both its argument parsers and results in the result of the first one to succeed.
(<!>) :: (String -> [(a,String)]) -> (String -> [(a,String)]) -> String -> [(a,String)]   
Builds a parser that tries its first argument parser and alternatively, if the first one does not succeed, its second argument parser.
(<$>) :: (a -> b) -> (String -> [(a,String)]) -> String -> [(b,String)]   
Builds a parser that applies a function to the result of the original parser.
(<*>) :: (String -> [(a -> b,String)]) -> (String -> [(a,String)]) -> String -> [(b,String)]   
Applies the function returned by the first parser to the result of the second parser.
(<*) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]   
Builds a parser that applies both parsers in order and returns the result of the first one.
(*>) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]   
Builds a parser that applies both parsers in order and returns the result of the second one.
(*>=) :: (String -> [(a,String)]) -> (a -> String -> [(b,String)]) -> String -> [(b,String)]   
many :: (String -> [(a,String)]) -> String -> [([a],String)]   
Builds a parser that will apply the original parser arbitrarily many times.
some :: (String -> [(a,String)]) -> String -> [([a],String)]   
Builds a parser that will apply the original parser at least once.

Exported datatypes:


Parser

A parser

Type synonym: Parser a = String -> [(a,String)]


Exported operations:

parse :: (String -> [(a,String)]) -> String -> Maybe a   

Applies a parser to a string. If it succeeds, returns the result of the parser. Returns Nothing if it does not.

failure :: String -> [(a,String)]   

A parser that always fails.

Further infos:
  • solution complete, i.e., able to compute all solutions

yield :: a -> String -> [(a,String)]   

A parser that consumes no input and results in the given value.

Further infos:
  • solution complete, i.e., able to compute all solutions

empty :: String -> [((),String)]   

A parser that consumes no input and results in the unit value.

Further infos:
  • solution complete, i.e., able to compute all solutions

anyChar :: String -> [(Char,String)]   

A parser that consumes an arbitrary single character.

check :: (a -> Bool) -> (String -> [(a,String)]) -> String -> [(a,String)]   

Builds a parser that succeeds if the predicate holds on the result of the original parser.

char :: Char -> String -> [((),String)]   

Builds a parser that consumes a specific character and results in the unit value.

word :: String -> String -> [((),String)]   

Builds a parser that consumes the given string and results in the unit value.

(<|>) :: (String -> [(a,String)]) -> (String -> [(a,String)]) -> String -> [(a,String)]   

Builds a parser that tries both its argument parsers and results in the result of the first one to succeed.

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

(<!>) :: (String -> [(a,String)]) -> (String -> [(a,String)]) -> String -> [(a,String)]   

Builds a parser that tries its first argument parser and alternatively, if the first one does not succeed, its second argument parser. In contrast to <|>, this combinator does not backtrack. The second parser is applied to the leftovers of the first parser. Use it if the alternatives are mutually exclusive.

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

(<$>) :: (a -> b) -> (String -> [(a,String)]) -> String -> [(b,String)]   

Builds a parser that applies a function to the result of the original parser.

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

(<*>) :: (String -> [(a -> b,String)]) -> (String -> [(a,String)]) -> String -> [(b,String)]   

Applies the function returned by the first parser to the result of the second parser. Applies the parsers in order.

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

(<*) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]   

Builds a parser that applies both parsers in order and returns the result of the first one.

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

(*>) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]   

Builds a parser that applies both parsers in order and returns the result of the second one.

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

(*>=) :: (String -> [(a,String)]) -> (a -> String -> [(b,String)]) -> String -> [(b,String)]   

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

many :: (String -> [(a,String)]) -> String -> [([a],String)]   

Builds a parser that will apply the original parser arbitrarily many times.

some :: (String -> [(a,String)]) -> String -> [([a],String)]   

Builds a parser that will apply the original parser at least once.