Copyright | (c) Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2014, Paweł Nowak 2014 |
---|---|
License | MIT |
Maintainer | Paweł Nowak <pawel834@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Combinators that work with any sequence type.
- optional :: SemiIsoAlternative f => f a -> f (Maybe a)
- opt :: SemiIsoAlternative f => f () -> f ()
- opt_ :: SemiIsoAlternative f => f () -> f ()
- manyTill :: SemiIsoAlternative f => f a -> f () -> f [a]
- sepBy :: SemiIsoAlternative f => f a -> f () -> f [a]
- sepBy1 :: SemiIsoAlternative f => f a -> f () -> f [a]
- choice :: SemiIsoAlternative f => [f a] -> f a
- eitherOf :: SemiIsoAlternative f => f a -> f b -> f (Either a b)
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.