Safe Haskell | None |
---|---|
Language | Haskell2010 |
- atom :: (t -> atom) -> Parser t -> Parser atom
- mkAtomParser :: [Parser atom] -> SExprParser atom (SExpr atom)
Documentation
This module defines small convenience functions for building an atom type from several individual parsers. This is easy to do without these functions, but these functions communicate intent more directly:
data Atom = Ident Text | Num Integer myParser :: SExprParser Atom (SExpr Atom) myParser = mkAtomParser [ atom Ident parseR7RSIdent , atom Num signedDecNumber ]
mkAtomParser :: [Parser atom] -> SExprParser atom (SExpr atom) Source #
A convenience function for defining a SExprSpec
from a list of
possible atom parsers, which will be tried in sequence before failing.