syntax-0.2.1.0: Syntax descriptions for unified parsing and pretty-printing.

Copyright(c) Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2014, Paweł Nowak 2014
LicenseMIT
MaintainerPaweł Nowak <pawel834@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.Syntax.Combinator

Description

Combinators that work with any sequence type.

Synopsis

Documentation

optional :: SemiIsoAlternative f => f a -> f (Maybe a) Source

One or zero occurences of f.

opt :: SemiIsoAlternative f => f () -> f () Source

Like optional, but specialized for ().

opt_ :: SemiIsoAlternative f => f () -> f () Source

Parser one or zero occurences of f, but prints nothing.

manyTill :: SemiIsoAlternative f => f a -> f () -> f [a] Source

manyTill p end applies action p zero or more times until action end succeeds, and returns the list of values returned by p.

sepBy :: SemiIsoAlternative f => f a -> f () -> f [a] Source

Zero or more occurences of v separated by s.

sepBy1 :: SemiIsoAlternative f => f a -> f () -> f [a] Source

One or more occurences of v separated by s.

choice :: SemiIsoAlternative f => [f a] -> f a Source

Tries to apply the actions in the list in order, until one of them succeeds. Returns the value of the succeeding action.

eitherOf :: SemiIsoAlternative f => f a -> f b -> f (Either a b) Source

Combine two alternatives.