containers

A modular, clean and powerful extension of the OCaml standard library
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library containers
Module CCParse . Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Map.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Monadic bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The results of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a. See try_ to ensure a does not consume anything (but it is best to avoid wrapping large parsers with try_).

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails without consuming any input, it fails with msg instead. Useful as the last choice in a series of <|>: a <|> b <|> c <?> "expected a|b|c".