Copyright | (c) 2020 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Step a m r
- data Input a
- data ParseResult b
- newtype ParserK a m b = MkParser {}
- adaptC :: (Monad m, Unbox a) => Parser a m b -> ParserK (Array a) m b
- adapt :: Monad m => Parser a m b -> ParserK a m b
- adaptCG :: Monad m => Parser a m b -> ParserK (Array a) m b
- fromPure :: b -> ParserK a m b
- fromEffect :: Monad m => m b -> ParserK a m b
- die :: String -> ParserK a m b
Documentation
The intermediate result of running a parser step. The parser driver may stop with a final result, pause with a continuation to resume, or fail with an error.
See ParserD docs. This is the same as the ParserD Step except that it uses a continuation in Partial and Continue constructors instead of a state in case of ParserD.
Pre-release
data ParseResult b Source #
The parser's result.
Int is the position index into the current input array. Could be negative. Cannot be beyond the input array max bound.
Pre-release
Instances
Functor ParseResult Source # | Map a function over |
Defined in Streamly.Internal.Data.ParserK.Type fmap :: (a -> b) -> ParseResult a -> ParseResult b Source # (<$) :: a -> ParseResult b -> ParseResult a Source # |
newtype ParserK a m b Source #
A continuation passing style parser representation. A continuation of
Step
s, each step passes a state and a parse result to the next Step
. The
resulting Step
may carry a continuation that consumes input a
and
results in another Step
. Essentially, the continuation may either consume
input without a result or return a result with no further input to be
consumed.
Instances
Monad m => MonadFail (ParserK a m) Source # | |
MonadIO m => MonadIO (ParserK a m) Source # | |
Monad m => Alternative (ParserK a m) Source # |
|
Monad m => Applicative (ParserK a m) Source # |
|
Defined in Streamly.Internal.Data.ParserK.Type pure :: a0 -> ParserK a m a0 Source # (<*>) :: ParserK a m (a0 -> b) -> ParserK a m a0 -> ParserK a m b Source # liftA2 :: (a0 -> b -> c) -> ParserK a m a0 -> ParserK a m b -> ParserK a m c Source # (*>) :: ParserK a m a0 -> ParserK a m b -> ParserK a m b Source # (<*) :: ParserK a m a0 -> ParserK a m b -> ParserK a m a0 Source # | |
Functor m => Functor (ParserK a m) Source # | Map a function on the result i.e. on |
Monad m => Monad (ParserK a m) Source # | Monad composition can be used for lookbehind parsers, we can dynamically compose new parsers based on the results of the previously parsed values. |
Monad m => MonadPlus (ParserK a m) Source # |
|
adaptC :: (Monad m, Unbox a) => Parser a m b -> ParserK (Array a) m b Source #
Convert an element Parser
to a chunked ParserK
. A chunked parser is
more efficient than an element parser.
Pre-release
fromPure :: b -> ParserK a m b Source #
A parser that always yields a pure value without consuming any input.
Pre-release
fromEffect :: Monad m => m b -> ParserK a m b Source #
See fromEffect
.
Pre-release