Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Text.Cassette.Combinator
- choice :: [PP a] -> PP a
- count :: Int -> PP a -> PP [a]
- option :: a -> PP a -> PP a
- optionMaybe :: PP a -> PP (Maybe a)
- optional :: PP a -> PP0
- many :: PP a -> PP [a]
- many1 :: PP a -> PP [a]
- skipMany :: PP a -> PP0
- skipMany1 :: PP a -> PP0
- sepBy :: PP a -> PP0 -> PP [a]
- sepBy1 :: PP a -> PP0 -> PP [a]
- chainl :: PP0 -> BinL a a a -> PP a -> a -> PP a
- chainl1 :: PP0 -> BinL a a a -> PP a -> PP a
- chainr :: PP0 -> BinL a a a -> PP a -> a -> PP a
- chainr1 :: PP0 -> BinL a a a -> PP a -> PP a
- notFollowedBy :: PP0 -> PP0
- manyTill :: PP a -> PP0 -> PP [a]
Documentation
Applies each cassette in the supplied list in order, until one of them succeeds.
Tries to apply the given cassette. It returns the value of the cassette on success, the first argument otherwise.
optionMaybe :: PP a -> PP (Maybe a) #
Tries to apply the given cassette. It returns a value of the form Just
x
on success, Nothing
otherwise.
Tries to match the given cassette and discards the result, otherwise does nothing in case of failure.
sepBy :: PP a -> PP0 -> PP [a] #
Apply the first argument zero or more times, separated by the second argument.
sepBy1 :: PP a -> PP0 -> PP [a] #
Apply the first argument one or more times, separated by the second argument.
chainl :: PP0 -> BinL a a a -> PP a -> a -> PP a #
chainl p op x
matches zero or more occurrences of p
, separated by
op
. Returns a value obtained by a left associative application of all
functions returned by op
to the values returned by p
. If there are zero
occurrences of p
, the value x
is returned.
chainr :: PP0 -> BinL a a a -> PP a -> a -> PP a #
chainr p op x
matches zero or more occurrences of p
, separated by
op
. Returns a value obtained by a right associative application of all
functions returned by op
to the values returned by p
. If there are zero
occurrences of p
, the value x
is returned.
notFollowedBy :: PP0 -> PP0 #
notFollowedBy p
only succeeds when p
fails. This combinator does
not consume/produce any input.