|
@@ -107,7 +107,9 @@ cons x (R.RSAtom a) = R.RSDotted [x] a
|
|
--
|
|
--
|
|
-- >>> A "one" ::: L [A "two", A "three"]
|
|
-- >>> A "one" ::: L [A "two", A "three"]
|
|
-- RSList [RSAtom "one",RSAtom "two",RSAtom "three"]
|
|
-- RSList [RSAtom "one",RSAtom "two",RSAtom "three"]
|
|
|
|
+#if MIN_VERSION_base(4,8,0)
|
|
pattern (:::) :: RichSExpr a -> RichSExpr a -> RichSExpr a
|
|
pattern (:::) :: RichSExpr a -> RichSExpr a -> RichSExpr a
|
|
|
|
+#endif
|
|
pattern x ::: xs <- (uncons -> Just (x, xs))
|
|
pattern x ::: xs <- (uncons -> Just (x, xs))
|
|
#if MIN_VERSION_base(4,8,0)
|
|
#if MIN_VERSION_base(4,8,0)
|
|
where x ::: xs = cons x xs
|
|
where x ::: xs = cons x xs
|
|
@@ -117,28 +119,36 @@ pattern x ::: xs <- (uncons -> Just (x, xs))
|
|
--
|
|
--
|
|
-- >>> A "elephant"
|
|
-- >>> A "elephant"
|
|
-- RSAtom "elephant"
|
|
-- RSAtom "elephant"
|
|
|
|
+#if MIN_VERSION_base(4,8,0)
|
|
pattern A :: a -> RichSExpr a
|
|
pattern A :: a -> RichSExpr a
|
|
|
|
+#endif
|
|
pattern A a = R.RSAtom a
|
|
pattern A a = R.RSAtom a
|
|
|
|
|
|
-- | A shorter alias for `RSList`
|
|
-- | A shorter alias for `RSList`
|
|
--
|
|
--
|
|
-- >>> L [A "pachy", A "derm"]
|
|
-- >>> L [A "pachy", A "derm"]
|
|
-- RSList [RSAtom "pachy",RSAtom "derm"]
|
|
-- RSList [RSAtom "pachy",RSAtom "derm"]
|
|
|
|
+#if MIN_VERSION_base(4,8,0)
|
|
pattern L :: [RichSExpr a] -> RichSExpr a
|
|
pattern L :: [RichSExpr a] -> RichSExpr a
|
|
|
|
+#endif
|
|
pattern L xs = R.RSList xs
|
|
pattern L xs = R.RSList xs
|
|
|
|
|
|
-- | A shorter alias for `RSDotted`
|
|
-- | A shorter alias for `RSDotted`
|
|
--
|
|
--
|
|
-- >>> DL [A "pachy"] "derm"
|
|
-- >>> DL [A "pachy"] "derm"
|
|
-- RSDotted [RSAtom "pachy"] "derm"
|
|
-- RSDotted [RSAtom "pachy"] "derm"
|
|
|
|
+#if MIN_VERSION_base(4,8,0)
|
|
pattern DL :: [RichSExpr a] -> a -> RichSExpr a
|
|
pattern DL :: [RichSExpr a] -> a -> RichSExpr a
|
|
|
|
+#endif
|
|
pattern DL xs x = R.RSDotted xs x
|
|
pattern DL xs x = R.RSDotted xs x
|
|
|
|
|
|
-- | A shorter alias for `RSList` @[]@
|
|
-- | A shorter alias for `RSList` @[]@
|
|
--
|
|
--
|
|
-- >>> Nil
|
|
-- >>> Nil
|
|
-- RSList []
|
|
-- RSList []
|
|
|
|
+#if MIN_VERSION_base(4,8,0)
|
|
pattern Nil :: RichSExpr a
|
|
pattern Nil :: RichSExpr a
|
|
|
|
+#endif
|
|
pattern Nil = R.RSList []
|
|
pattern Nil = R.RSList []
|
|
|
|
|
|
-- | Utility function for parsing a pair of things: this parses a two-element list,
|
|
-- | Utility function for parsing a pair of things: this parses a two-element list,
|