gdritter repos s-cargot / ada65df
Shortened/diversified pattern aliases Getty Ritter 9 years ago
3 changed file(s) with 49 addition(s) and 10 deletion(s). Collapse all Expand all
33 module Data.SCargot.Repr.Basic
44 ( -- * Basic 'SExpr' representation
55 R.SExpr(..)
6 -- * Shorthand Patterns
7 , pattern (:::)
8 , pattern A
9 , pattern Nil
610 ) where
711
812 import Data.SCargot.Repr as R
13
14 -- | A shorter infix alias for `SCons`
15 pattern x ::: xs = SCons x xs
16
17 -- | A shorter alias for `SAtom`
18 pattern A x = SAtom x
19
20 -- | A (slightly) shorter alias for `SNil`
21 pattern Nil = SNil
66 , R.toRich
77 , R.fromRich
88 -- * Useful pattern synonyms
9 , pattern List
10 , pattern DotList
11 , pattern Atom
9 , pattern (:::)
10 , pattern A
11 , pattern L
12 , pattern DL
13 , pattern Nil
1214 ) where
1315
1416 import Data.SCargot.Repr as R
1517
16 pattern Atom a = R.RSAtom a
17 pattern List xs = R.RSList xs
18 pattern DotList xs x = R.RSDotted xs x
18 -- | A shorter infix alias to grab the head
19 -- and tail of an `RSList`.
20 pattern x ::: xs = R.RSList (x : xs)
21
22 -- | A shorter alias for `RSAtom`
23 pattern A a = R.RSAtom a
24
25 -- | A shorter alias for `RSList`
26 pattern L xs = R.RSList xs
27
28 -- | A shorter alias for `RSDotted`
29 pattern DL xs x = R.RSDotted xs x
30
31 -- | A shorter alias for `RSList []`
32 pattern Nil = R.RSList []
66 , R.toWellFormed
77 , R.fromWellFormed
88 -- * Useful pattern synonyms
9 , pattern List
10 , pattern Atom
9 , pattern (:::)
10 , pattern L
11 , pattern A
12 , pattern Nil
1113 ) where
1214
1315 import Data.SCargot.Repr as R
1416
15 pattern List xs = R.WFSList xs
16 pattern Atom a = R.WFSAtom a
17 -- | A shorter infix alias to grab the head
18 -- and tail of a `WFSList`
19 pattern x ::: xs = R.WFSList (x : xs)
20
21 -- | A shorter alias for `WFSList`
22 pattern L xs = R.WFSList xs
23
24 -- | A shorter alias for `WFSAtom`
25 pattern A a = R.WFSAtom a
26
27 -- | A shorter alias for `WFSList []`
28 pattern Nil = R.WFSList []