- 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
- canBeEmpty :: Freq t -> Bool
- split :: [Freq p] -> ([Freq p] -> [Freq p]) -> [(p, [Freq p])]
- toParser :: [Freq (P st (d -> d))] -> P st d -> P st d
- toParserSep :: [Freq (P st (b -> b))] -> P st a -> P st b -> P st b
- 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)
- pSem :: t -> MergeSpec (t1, t2, t -> t3 -> t4) -> MergeSpec (t1, t2, (t4 -> t5) -> t3 -> t5)
- pMerge :: c -> MergeSpec (d, [Freq (P st (d -> d))], c -> d -> e) -> P st e
- pMergeSep :: (c, P st a) -> MergeSpec (d, [Freq (P st (d -> d))], c -> d -> e) -> P st e
- pBetween :: Int -> Int -> P t t1 -> MergeSpec ([a], [Freq (P t ([t1] -> [t1]))], a1 -> a1)
- pAtMost :: Int -> P t t1 -> MergeSpec ([a], [Freq (P t ([t1] -> [t1]))], a1 -> a1)
- pAtLeast :: Int -> P t t1 -> MergeSpec ([a], [Freq (P t ([t1] -> [t1]))], a1 -> a1)
- pMany :: P t t1 -> MergeSpec ([a], [Freq (P t ([t1] -> [t1]))], a1 -> a1)
- pOpt :: P t t1 -> t11 -> MergeSpec (t11, [Freq (P t (b -> t1))], a -> a)
- pSome :: P t t1 -> MergeSpec ([a], [Freq (P t ([t1] -> [t1]))], a1 -> a1)
- pOne :: P t t1 -> MergeSpec (a, [Freq (P t (b -> t1))], a1 -> a1)
- mapFst :: (t -> t2) -> (t, t1) -> (t2, t1)
- mapSnd :: (t1 -> t2) -> (t, t1) -> (t, t2)

# 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.

# Merging parsers

canBeEmpty :: Freq t -> BoolSource