Deprecated. Please use toParserK instead.
Convert a Parser to ParserK.
Pre-release
:: a typeCtrl KGHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11
Modulestreamly-core-0.3.1Haskell2010
Deprecated. Please use toParserK instead.
Convert a Parser to ParserK.
Pre-release
chainl p op x is like chainl1 but allows zero or more occurrences of
p, separated by op. If there are zero occurrences of p, the value x
is returned.
chainl1 p op x parses one or more occurrences of p, separated by
op. Returns a value obtained by a left associative application of all
functions returned by op to the values returned by p.
num = Parser.decimalplus = Parser.char '+' *> pure (+)expr = ParserK.chainl1 (StreamK.toParserK num) (StreamK.toParserK plus)StreamK.parse expr $ StreamK.fromStream $ Stream.fromList "1+2+3"Right 6
If you're building full expression parsers with operator precedence and
associativity, consider using makeExprParser from the parser-combinators
package.
See also deintercalate.
chainr p op x is like chainr1 but allows zero or more occurrences of
p, separated by op. If there are zero occurrences of p, the value x
is returned.
Like chainl1 but parses right associative application of the operator instead of left associative.
num = Parser.decimalpow = Parser.char '^' *> pure (^)expr = ParserK.chainr1 (StreamK.toParserK num) (StreamK.toParserK pow)StreamK.parse expr $ StreamK.fromStream $ Stream.fromList "2^3^2"Right 512
A parser that always fails with an error message without consuming any input.
Pre-release
See fromEffect.
Pre-release
A parser that always yields a pure value without consuming any input.
Pre-release
A continuation to extract the result when a CPS parser is done.
Convert a CPS style ParserK to a direct style Parser.
Pre-release
Convert a Parser to ParserK.
Pre-release
The parser's result.
Int is the position index in the stream relative to the position on entry i.e. when the parser started running. When the parser enters the position index is zero. If the parser consumed n elements then the new position index would be n. If the parser is backtracking then the position index would be negative.
Pre-release
Functor ParseResultDefined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeMap a function over Success.
A continuation passing style parser representation.
Monad m => Monad (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeMonad composition can be used for lookbehind parsers, we can dynamically compose new parsers based on the results of the previously parsed values.
Functor m => Functor (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeMap a function on the result i.e. on b in Parser a m b.
Monad m => MonadFail (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeMonad m => Applicative (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.Typef <$> p1 <*> p2 applies parsers p1 and p2 sequentially to an input
stream. The first parser runs and processes the input, the remaining input
is then passed to the second parser. If both parsers succeed, their outputs
are applied to the function f. If either parser fails, the operation
fails.
Monad m => Alternative (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.Typep1 <|> p2 passes the input to parser p1, if it succeeds, the result is
returned. However, if p1 fails, the parser driver backtracks and tries the
same input on the alternative parser p2, returning the result if it
succeeds.
Monad m => MonadPlus (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeMonadIO m => MonadIO (ParserK a m)Defined in streamly-core-0.3.1 · Streamly.Internal.Data.ParserK.TypeThe intermediate result of running a parser step. The parser driver may (1) stop with a final result (Done) with no more inputs to be accepted, (2) generate an intermediate result (Partial) and accept more inputs, (3) generate no result but wait for more input (Continue), (4) or fail with an error (Error).
The Int is a count by which the current stream position should be adjusted before calling the next parsing step.
See the documentation of Streamly.Data.Parser.Step for more details, this
has the same semantics.
Pre-release
Deprecated. Use Streamly.Data.Array.toParserK
Deprecated. Use Streamly.Data.Array.Generic.toParserK