gdritter repos s-cargot / 7e6b626
Explanatory haddocks for Atom helpers Getty Ritter 6 years ago
1 changed file(s) with 21 addition(s) and 1 deletion(s). Collapse all Expand all
11 module Data.SCargot.Atom
2 ( atom
2 ( -- $intro
3
4 atom
35 , mkAtomParser
46 ) where
57
1820 -- possible atom parsers, which will be tried in sequence before failing.
1921 mkAtomParser :: [Parser atom] -> SExprParser atom (SExpr atom)
2022 mkAtomParser = mkParser . choice
23
24 {- $intro
25
26 This module defines small convenience functions for building an atom
27 type from several individual parsers. This is easy to do without these
28 functions, but these functions communicate intent more directly:
29
30 > data Atom
31 > = Ident Text
32 > | Num Integer
33 >
34 > myParser :: SExprParser Atom (SExpr Atom)
35 > myParser = mkAtomParser
36 > [ atom Ident parseR7RSIdent
37 > , atom Num signedDecNumber
38 > ]
39
40 -}