Copyright | (c) 2020 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Parallel parsers. Distributing the input to multiple parsers at the same time.
For simplicity, we are using code where a particular state is unreachable
but it is not prevented by types. Somehow uni-pattern match using "let"
produces better optimized code compared to using case
match and using
explicit error messages in unreachable cases.
There seem to be no way to silence individual warnings so we use a global incomplete uni-pattern match warning suppression option for the file. Disabling the warning for other code as well has the potential to mask off some legit warnings, therefore, we have segregated only the code that uses uni-pattern matches in this module.
Synopsis
- teeWith :: Monad m => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
- teeWithFst :: Monad m => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
- teeWithMin :: (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
- shortest :: Monad m => Parser m x a -> Parser m x a -> Parser m x a
- longest :: MonadCatch m => Parser m x a -> Parser m x a -> Parser m x a
Documentation
teeWith :: Monad m => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c Source #
teeWith f p1 p2
distributes its input to both p1
and p2
until both
of them succeed or fail and combines their output using f
. The parser
succeeds if both the parsers succeed.
Internal
teeWithFst :: Monad m => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c Source #
Like teeWith
but ends parsing and zips the results, if available,
whenever the first parser ends.
Internal
teeWithMin :: (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c Source #
Like teeWith
but ends parsing and zips the results, if available,
whenever any of the parsers ends or fails.
Unimplemented