| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Symparsec.Run
Synopsis
- type Run p sym = MapLeftRender (Run' p sym)
- type family MapLeftRender eer where ...
- type family Run' p str where ...
- type RunTest p sym = MapLeftTypeError (Run p sym)
- type Run'_ p str = Run'_Inner (Run' p str)
- type family Run'_Inner eeab where ...
- run' :: forall {s} {r} (p :: PParser s r) r'. SingParser p => (forall a. PR p a -> r') -> String -> Either (ERun String) (r', String)
- runTest :: forall {s} {r} (p :: PParser s r). (SingParser p, Demotable (PR p)) => String -> (Demote (PR p), String)
- sRun' :: SParser ss sr p -> SSymbol str -> SEither SERun (STuple2 sr SSymbol) (Run' p str)
- type family RunStart pCh pEnd s0 mstr where ...
- sRunStart :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> ss s0 -> SMaybe (STuple2 SChar SSymbol) mstr -> SEither SERun (STuple2 sr SSymbol) (RunStart pCh pEnd s0 mstr)
- type family MapLeftTypeError eea where ...
- type family RunCh pCh pEnd idx ch' mstr res where ...
- sRunCh :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> SNat idx -> SChar chPrev -> SMaybe (STuple2 SChar SSymbol) mstr -> SResult ss sr res -> SEither SERun (STuple2 sr SSymbol) (RunCh pCh pEnd idx chPrev mstr res)
- type family RunEnd idx ch res where ...
- sRunEnd :: SNat idx -> SChar ch -> SEither SE sr res -> SEither SERun (STuple2 sr SSymbol) (RunEnd idx ch res)
- type family RunEnd0 res where ...
- sRunEnd0 :: SEither SE sr res -> SEither SERun (STuple2 sr SSymbol) (RunEnd0 res)
- type family PrettyERun e where ...
- type family PrettyE e where ...
- data ERun s
- type PERun = ERun Symbol
- data SERun (erun :: PERun) where
- demoteSERun :: SERun erun -> ERun String
Documentation
type Run p sym = MapLeftRender (Run' p sym) Source #
Run the given parser on the given Symbol, returning an ErrorMessage
on failure.
type family MapLeftRender eer where ... Source #
Equations
| MapLeftRender (Right a) = Right a | |
| MapLeftRender (Left e) = Left (RenderPDoc (PrettyERun e)) |
type family Run' p str where ... Source #
Equations
| Run' ('PParser pCh pEnd s0) str = RunStart pCh pEnd s0 (UnconsSymbol str) |
type RunTest p sym = MapLeftTypeError (Run p sym) Source #
type Run'_ p str = Run'_Inner (Run' p str) Source #
type family Run'_Inner eeab where ... Source #
Equations
| Run'_Inner (Right '(a, b)) = Right a | |
| Run'_Inner (Left e) = Left (RenderPDoc (PrettyERun e)) |
run' :: forall {s} {r} (p :: PParser s r) r'. SingParser p => (forall a. PR p a -> r') -> String -> Either (ERun String) (r', String) Source #
runTest :: forall {s} {r} (p :: PParser s r). (SingParser p, Demotable (PR p)) => String -> (Demote (PR p), String) Source #
sRunStart :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> ss s0 -> SMaybe (STuple2 SChar SSymbol) mstr -> SEither SERun (STuple2 sr SSymbol) (RunStart pCh pEnd s0 mstr) Source #
type family MapLeftTypeError eea where ... Source #
Equations
| MapLeftTypeError (Right a) = a | |
| MapLeftTypeError (Left e) = TypeError e |
type family RunCh pCh pEnd idx ch' mstr res where ... Source #
Inspect character parser result.
This is purposely written so that the main case is at the top, and a single equation (we parse, prepare next character and inspect character parser result at the same time). My hope is that this keeps GHC fast.
Equations
| RunCh pCh pEnd idx ch' (Just '(ch, sym)) (Cont s) = RunCh pCh pEnd (idx + 1) ch (UnconsSymbol sym) ((pCh @@ ch) @@ s) | |
| RunCh pCh pEnd idx ch' Nothing (Cont s) = RunEnd idx ch' (pEnd @@ s) | |
| RunCh pCh pEnd idx ch' mstr (Done r) = Right '(r, ConsSymbol ch' (ReconsSymbol mstr)) | |
| RunCh pCh pEnd idx ch' mstr (Err e) = Left ('ERun idx ch' e) |
sRunCh :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> SNat idx -> SChar chPrev -> SMaybe (STuple2 SChar SSymbol) mstr -> SResult ss sr res -> SEither SERun (STuple2 sr SSymbol) (RunCh pCh pEnd idx chPrev mstr res) Source #
sRunEnd :: SNat idx -> SChar ch -> SEither SE sr res -> SEither SERun (STuple2 sr SSymbol) (RunEnd idx ch res) Source #
type family RunEnd0 res where ... Source #
Inspect end parser result for the empty string, where we have no previous character or (meaningful) index.
type family PrettyERun e where ... Source #
Error while running parser.
Constructors
| ERun Natural Char (E s) | Parser error at index X, character C. |
| ERun0 (E s) | Parser error on the empty string. |