| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Parser.Examples
Contents
Description
Example instantiations of the unified parser over different base monads.
The primitives in Circuit.Parser are polymorphic in the base monad
m. This module shows how to run the same parser syntax under two
different interpretations:
Identity— attoparsec-style pure parserStateT st (ExceptT e n)— megaparsec-style state + errors
Runners
runMega :: forall e st n f a. (Monad n, Uncons f Char) => Parser (StateT st (ExceptT e n)) f Char a -> f -> st -> n (Either e (These a f, st)) Source #
Megaparsec-style runner: stateful, error-aware.
The state st can hold offset, tab width, etc. Errors are returned via
ExceptT e n.