symbol-parser-0.3.0: Type level string parser combinators
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Type.Symbol.Parser.Parser.Or

Description

Choice operator. Try left; if it fails, try right.

This is a problematic combinator:

  • Implementation is clumsy due to internal parser state being untouchable. We must record seen characters, in order to replay them on the right parser in case the left parser fails.
  • Errors degrade due to left parser errors being discarded. Perhaps your string was one character off a successful left parse; but if it fails, you won't see that error.
  • It's hard to reason aobut. It might break in certain situations.

Documentation

type family Or pl pr where ... Source #

Equations

Or '(plCh, plEnd, sl) '(prCh, prEnd, sr) = '(OrChSym plCh prCh sr, OrEndSym plEnd prCh prEnd sr, Left '(sl, '[]))