gdritter repos s-cargot / eb0baef
Version guards for GHC 7.8 Getty Ritter 6 years ago
3 changed file(s) with 28 addition(s) and 0 deletion(s). Collapse all Expand all
8888 --
8989 -- >>> A "pachy" ::: A "derm"
9090 -- SCons (SAtom "pachy") (SAtom "derm")
91 #if MIN_VERSION_base(4,8,0)
9192 pattern (:::) :: SExpr a -> SExpr a -> SExpr a
93 #endif
9294 pattern x ::: xs = SCons x xs
9395
9496 -- | A shorter alias for `SAtom`
9597 --
9698 -- >>> A "elephant"
9799 -- SAtom "elephant"
100 #if MIN_VERSION_base(4,8,0)
98101 pattern A :: a -> SExpr a
102 #endif
99103 pattern A x = SAtom x
100104
101105 -- | A (slightly) shorter alias for `SNil`
102106 --
103107 -- >>> Nil
104108 -- SNil
109 #if MIN_VERSION_base(4,8,0)
105110 pattern Nil :: SExpr a
111 #endif
106112 pattern Nil = SNil
107113
108114 -- | An alias for matching a proper list.
109115 --
110116 -- >>> L [A "pachy", A "derm"]
111117 -- SExpr (SAtom "pachy") (SExpr (SAtom "derm") SNil)
118 #if MIN_VERSION_base(4,8,0)
112119 pattern L :: [SExpr a] -> SExpr a
120 #endif
113121 pattern L xs <- (gatherList -> Right xs)
114122 #if MIN_VERSION_base(4,8,0)
115123 where L [] = SNil
121129 --
122130 -- >>> DL [A "pachy"] A "derm"
123131 -- SExpr (SAtom "pachy") (SAtom "derm")
132 #if MIN_VERSION_base(4,8,0)
124133 pattern DL :: [SExpr a] -> a -> SExpr a
134 #endif
125135 pattern DL xs x <- (gatherDList -> Just (xs, x))
126136 #if MIN_VERSION_base(4,8,0)
127137 where DL [] a = SAtom a
107107 --
108108 -- >>> A "one" ::: L [A "two", A "three"]
109109 -- RSList [RSAtom "one",RSAtom "two",RSAtom "three"]
110 #if MIN_VERSION_base(4,8,0)
110111 pattern (:::) :: RichSExpr a -> RichSExpr a -> RichSExpr a
112 #endif
111113 pattern x ::: xs <- (uncons -> Just (x, xs))
112114 #if MIN_VERSION_base(4,8,0)
113115 where x ::: xs = cons x xs
117119 --
118120 -- >>> A "elephant"
119121 -- RSAtom "elephant"
122 #if MIN_VERSION_base(4,8,0)
120123 pattern A :: a -> RichSExpr a
124 #endif
121125 pattern A a = R.RSAtom a
122126
123127 -- | A shorter alias for `RSList`
124128 --
125129 -- >>> L [A "pachy", A "derm"]
126130 -- RSList [RSAtom "pachy",RSAtom "derm"]
131 #if MIN_VERSION_base(4,8,0)
127132 pattern L :: [RichSExpr a] -> RichSExpr a
133 #endif
128134 pattern L xs = R.RSList xs
129135
130136 -- | A shorter alias for `RSDotted`
131137 --
132138 -- >>> DL [A "pachy"] "derm"
133139 -- RSDotted [RSAtom "pachy"] "derm"
140 #if MIN_VERSION_base(4,8,0)
134141 pattern DL :: [RichSExpr a] -> a -> RichSExpr a
142 #endif
135143 pattern DL xs x = R.RSDotted xs x
136144
137145 -- | A shorter alias for `RSList` @[]@
138146 --
139147 -- >>> Nil
140148 -- RSList []
149 #if MIN_VERSION_base(4,8,0)
141150 pattern Nil :: RichSExpr a
151 #endif
142152 pattern Nil = R.RSList []
143153
144154 -- | Utility function for parsing a pair of things: this parses a two-element list,
5959 -- instead.
6060 --
6161 -- >>> let sum (x ::: xs) = x + sum xs; sum Nil = 0
62 #if MIN_VERSION_base(4,8,0)
6263 pattern (:::) :: WellFormedSExpr a -> WellFormedSExpr a -> WellFormedSExpr a
64 #endif
6365 pattern x ::: xs <- (uncons -> Just (x, xs))
6466
6567 -- | A shorter alias for `WFSList`
6668 --
6769 -- >>> L [A "pachy", A "derm"]
6870 -- WFSList [WFSAtom "pachy",WFSAtom "derm"]
71 #if MIN_VERSION_base(4,8,0)
6972 pattern L :: [WellFormedSExpr t] -> WellFormedSExpr t
73 #endif
7074 pattern L xs = R.WFSList xs
7175
7276 -- | A shorter alias for `WFSAtom`
7377 --
7478 -- >>> A "elephant"
7579 -- WFSAtom "elephant"
80 #if MIN_VERSION_base(4,8,0)
7681 pattern A :: t -> WellFormedSExpr t
82 #endif
7783 pattern A a = R.WFSAtom a
7884
7985 -- | A shorter alias for `WFSList` @[]@
8086 --
8187 -- >>> Nil
8288 -- WFSList []
89 #if MIN_VERSION_base(4,8,0)
8390 pattern Nil :: WellFormedSExpr t
91 #endif
8492 pattern Nil = R.WFSList []
8593
8694 getShape :: WellFormedSExpr a -> String