HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestreamly-core-0.2.2Haskell2010

Streamly.Internal.Data.ParserK

  • 4 types
  • 6 values
datadata Step a (m :: Type -> Type) r
#

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

Constructors

Instances1Functor
  • Functor m => Functor (Step a m)Defined in streamly-core-0.2.2 · Streamly.Internal.Data.ParserK.Type
valuefromPure :: b -> ParserK a m b
#

A parser that always yields a pure value without consuming any input.

Pre-release

newtypenewtype ParserK a (m :: Type -> Type) b
#

A continuation passing style parser representation. A continuation of Steps, 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.

Constructors

Instances7Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus, …
  • Monad m => Monad (ParserK a m)Defined in streamly-core-0.2.2 · Streamly.Internal.Data.ParserK.Type

    Monad 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.2.2 · Streamly.Internal.Data.ParserK.Type

    Map 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.2.2 · Streamly.Internal.Data.ParserK.Type
  • Monad m => Applicative (ParserK a m)Defined in streamly-core-0.2.2 · Streamly.Internal.Data.ParserK.Type

    f <$> 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.2.2 · Streamly.Internal.Data.ParserK.Type

    p1 <|> 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.2.2 · Streamly.Internal.Data.ParserK.Type

    mzero is same as empty, it aborts the parser. mplus is same as <|>, it selects the first succeeding parser.

  • MonadIO m => MonadIO (ParserK a m)Defined in streamly-core-0.2.2 · Streamly.Internal.Data.ParserK.Type
datadata ParseResult b
#

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

Constructors

Instances1Functor
valuedie :: String -> ParserK a m b
#

A parser that always fails with an error message without consuming any input.

Pre-release