| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Symparsec.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 about. It might break in certain situations.
Synopsis
- type family pl :<|>: pr where ...
Documentation
type family pl :<|>: pr where ... infixl 3 Source #
Parser choice. Try left; if it fails, backtrack and try right.
Be warned that this parser is experimental, and likely brittle. If possible, consider designing your schema to permit non-backtracking parsing. Or if not, have both sides always parse the same length, in which case this parser should probably work fine.