- pReturn :: a -> P str a
- pFail :: P str a
- opt :: P st a -> a -> P st a
- pMaybe :: P st a -> P st (Maybe a)
- pEither :: P str a -> P str b -> P str (Either a b)
- (<$$>) :: (a -> b -> c) -> P st b -> P st (a -> c)
- (<??>) :: P st a -> P st (a -> a) -> P st a
- pPacked :: P st b1 -> P st b2 -> P st a -> P st a
- pFoldr :: (a -> a1 -> a1, a1) -> P st a -> P st a1
- pFoldr_ng :: (a -> a1 -> a1, a1) -> P st a -> P st a1
- pFoldr1 :: (v -> b -> b, b) -> P st v -> P st b
- pFoldr1_ng :: (v -> b -> b, b) -> P st v -> P st b
- pFoldrSep :: (v -> b -> b, b) -> P st a -> P st v -> P st b
- pFoldrSep_ng :: (v -> b -> b, b) -> P st a -> P st v -> P st b
- pFoldr1Sep :: (a -> b -> b, b) -> P st a1 -> P st a -> P st b
- pFoldr1Sep_ng :: (a -> b -> b, b) -> P st a1 -> P st a -> P st b
- list_alg :: (a -> [a] -> [a], [a1])
- pList :: P st a -> P st [a]
- pList_ng :: P st a -> P st [a]
- pList1 :: P st a -> P st [a]
- pList1_ng :: P st a -> P st [a]
- pListSep :: P st a1 -> P st a -> P st [a]
- pListSep_ng :: P st a1 -> P st a -> P st [a]
- pList1Sep :: P st a1 -> P st a -> P st [a]
- pList1Sep_ng :: P st a1 -> P st a -> P st [a]
- pChainr :: P st (c -> c -> c) -> P st c -> P st c
- pChainr_ng :: P st (c -> c -> c) -> P st c -> P st c
- pChainl :: P st (c -> c -> c) -> P st c -> P st c
- pChainl_ng :: P st (c -> c -> c) -> P st c -> P st c
- pAny :: (a -> P st a1) -> [a] -> P st a1
- pAnySym :: Provides st s s => [s] -> P st s
- data Freq p
- data Tree p = Br [(p, Tree p)] Bool
- toTree :: [Freq p] -> Tree p
- toParser :: Tree (P st (d -> d)) -> d -> P st d
- newtype MergeSpec p = MergeSpec p
- (<||>) :: MergeSpec (c, [Freq (P st (d -> d))], e -> f -> g) -> MergeSpec (h, [Freq (P st (i -> i))], g -> j -> k) -> MergeSpec ((c, h), [Freq (P st ((d, i) -> (d, i)))], e -> (f, j) -> k)
- pMerge :: c -> MergeSpec (d, [Freq (P st (d -> d))], c -> d -> e) -> P st e
Some common combinators for oft occurring constructs
opt :: P st a -> a -> P st aSource
Optionally recognize parser p
.
If p
can be recognized, the return value of p
is used. Otherwise,
the value v
is used. Note that opt is greedy, if you do not want
this use ... | pure v
instead. Furthermore, p
should not
recognise the empty string, since this would make your parser ambiguous!!
pMaybe :: P st a -> P st (Maybe a)Source
pMaybe
greedily recognises its argument. If not Nothing
is returned.
pEither :: P str a -> P str b -> P str (Either a b)Source
pEither
recognises either one of its arguments.
(<??>) :: P st a -> P st (a -> a) -> P st aSource
??
parses an optional postfix element and applies its result to its left hand result
pPacked :: P st b1 -> P st b2 -> P st a -> P st aSource
surrounds its third parser with the first and the seond one, keeping only the middle result
pPackes
The collection of iterating combinators, all in a greedy (default) and a non-greedy variant
pFoldr1_ng :: (v -> b -> b, b) -> P st v -> P st bSource
pFoldrSep_ng :: (v -> b -> b, b) -> P st a -> P st v -> P st bSource
pFoldr1Sep :: (a -> b -> b, b) -> P st a1 -> P st a -> P st bSource
pFoldr1Sep_ng :: (a -> b -> b, b) -> P st a1 -> P st a -> P st bSource
pListSep_ng :: P st a1 -> P st a -> P st [a]Source
pList1Sep_ng :: P st a1 -> P st a -> P st [a]Source
pChainr_ng :: P st (c -> c -> c) -> P st c -> P st cSource
pChainl_ng :: P st (c -> c -> c) -> P st c -> P st cSource
pAny :: (a -> P st a1) -> [a] -> P st a1Source
Build a parser for each elemnt in its argument list and tries them all.