Explanatory haddocks for Atom helpers
Getty Ritter
7 years ago
1 | 1 | module Data.SCargot.Atom |
2 |
( |
|
2 | ( -- $intro | |
3 | ||
4 | atom | |
3 | 5 | , mkAtomParser |
4 | 6 | ) where |
5 | 7 | |
18 | 20 | -- possible atom parsers, which will be tried in sequence before failing. |
19 | 21 | mkAtomParser :: [Parser atom] -> SExprParser atom (SExpr atom) |
20 | 22 | 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 | -} |