symparsec
Safe HaskellNone
LanguageGHC2021

Symparsec

Description

Top-level Symparsec module, exporting builtin parsers and runners.

I suggest importing this module qualified. Or, consider the following imports:

import Symparsec.Run qualified as Symparsec
import Symparsec.Parsers qualified as P
-- > :k! Symparsec.Run (P.Take 1) "hello"
Synopsis

Base definitions

type Run (p :: PParser a) (str :: Symbol) = RunEnd str (p @@ StateInit str) Source #

Run the given parser on the given Symbol.

  • On success, returns a tuple of (result :: a, remaining :: Symbol).
  • On failure, returns an ErrorMessage.

type RunTest (p :: PParser a) (str :: Symbol) = FromRightTypeError (Run p str) Source #

Run the given parser on the given Symbol, emitting a type error on failure.

This would be useful for :k! runs, but it doesn't work properly with TypeErrors, printing = (TypeError ...) instead of the error message. Alas! Instead, do something like > Proxy @(RunTest ...).

Parsers