Safe Haskell | None |
---|---|
Language | Haskell2010 |
Tools to write parsers using Flows
- data ParseError
- data Choice a = Choice
- choice :: forall m fs zs. (Monad m, HFoldl (Choice ParseError) (Flow m '[ParseError]) fs (Flow m zs)) => HList fs -> Flow m zs
- choice' :: forall a m fs zs. (Monad m, HFoldl (Choice a) (Flow m '[a]) fs (Flow m zs)) => HList fs -> Flow m zs
- manyBounded :: forall zs xs m. (zs ~ Filter ParseError xs, Monad m, MaybePopable ParseError xs) => Maybe Word -> Maybe Word -> Flow m xs -> Flow m '[[Variant zs], ParseError]
- manyAtMost :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> Flow m '[[Variant zs]]
- manyAtMost' :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> m [Variant zs]
- manyAtMost'' :: ('[x] ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> m [x]
- many :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Flow m xs -> Flow m '[[Variant zs]]
- manyAtLeast :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> Flow m '[[Variant zs], ParseError]
- manyTill :: (zs ~ Filter ParseError xs, zs' ~ Filter ParseError ys, Monad m, MaybePopable ParseError xs, Popable ParseError ys) => Flow m xs -> Flow m ys -> Flow m '[([Variant zs], Variant zs'), ParseError]
- manyTill' :: (zs ~ Filter ParseError xs, Monad m, MaybePopable ParseError xs, Popable ParseError ys) => Flow m xs -> Flow m ys -> Flow m '[[Variant zs], ParseError]
Documentation
data ParseError Source #
Parser error
choice :: forall m fs zs. (Monad m, HFoldl (Choice ParseError) (Flow m '[ParseError]) fs (Flow m zs)) => HList fs -> Flow m zs Source #
Try to apply the actions in the list in order, until one of them succeeds. Returns the value of the succeeding action, or the value of the last one. Failures are detected with values of type ParseError.
choice' :: forall a m fs zs. (Monad m, HFoldl (Choice a) (Flow m '[a]) fs (Flow m zs)) => HList fs -> Flow m zs Source #
Try to apply the actions in the list in order, until one of them succeeds. Returns the value of the succeeding action, or the value of the last one. Failures are detected with values of type "a".
manyBounded :: forall zs xs m. (zs ~ Filter ParseError xs, Monad m, MaybePopable ParseError xs) => Maybe Word -> Maybe Word -> Flow m xs -> Flow m '[[Variant zs], ParseError] Source #
Apply the given action at least min
times and at most max
time
On failure, fails.
manyAtMost :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> Flow m '[[Variant zs]] Source #
Apply the action zero or more times (up to max) until a ParseError result is returned
manyAtMost' :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> m [Variant zs] Source #
Apply the action zero or more times (up to max) until a ParseError result is returned
manyAtMost'' :: ('[x] ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> m [x] Source #
Apply the action zero or more times (up to max) until a ParseError result is returned
many :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Flow m xs -> Flow m '[[Variant zs]] Source #
Apply the action zero or more times (until a ParseError result is returned)
manyAtLeast :: (zs ~ Filter ParseError xs, Monad m, Popable ParseError xs) => Word -> Flow m xs -> Flow m '[[Variant zs], ParseError] Source #
Apply the action at least n times or more times (until a ParseError result is returned)
manyTill :: (zs ~ Filter ParseError xs, zs' ~ Filter ParseError ys, Monad m, MaybePopable ParseError xs, Popable ParseError ys) => Flow m xs -> Flow m ys -> Flow m '[([Variant zs], Variant zs'), ParseError] Source #
Apply the first action zero or more times until the second succeeds. If the first action fails, the whole operation fails.
Return both the list of first values and the ending value
manyTill' :: (zs ~ Filter ParseError xs, Monad m, MaybePopable ParseError xs, Popable ParseError ys) => Flow m xs -> Flow m ys -> Flow m '[[Variant zs], ParseError] Source #
Apply the first action zero or more times until the second succeeds. If the first action fails, the whole operation fails.
Return only the list of first values