Przeglądaj źródła

Version guards for GHC 7.8

Getty Ritter 7 lat temu
rodzic
commit
eb0baef2fe

+ 10 - 0
Data/SCargot/Repr/Basic.hs

@@ -88,28 +88,36 @@ infixr 5 :::
 --
 -- >>> A "pachy" ::: A "derm"
 -- SCons (SAtom "pachy") (SAtom "derm")
+#if MIN_VERSION_base(4,8,0)
 pattern (:::) :: SExpr a -> SExpr a -> SExpr a
+#endif
 pattern x ::: xs = SCons x xs
 
 -- | A shorter alias for `SAtom`
 --
 -- >>> A "elephant"
 -- SAtom "elephant"
+#if MIN_VERSION_base(4,8,0)
 pattern A :: a -> SExpr a
+#endif
 pattern A x = SAtom x
 
 -- | A (slightly) shorter alias for `SNil`
 --
 -- >>> Nil
 -- SNil
+#if MIN_VERSION_base(4,8,0)
 pattern Nil :: SExpr a
+#endif
 pattern Nil = SNil
 
 -- | An alias for matching a proper list.
 --
 -- >>> L [A "pachy", A "derm"]
 -- SExpr (SAtom "pachy") (SExpr (SAtom "derm") SNil)
+#if MIN_VERSION_base(4,8,0)
 pattern L :: [SExpr a] -> SExpr a
+#endif
 pattern L xs <- (gatherList -> Right xs)
 #if MIN_VERSION_base(4,8,0)
   where L []     = SNil
@@ -121,7 +129,9 @@ pattern L xs <- (gatherList -> Right xs)
 --
 -- >>> DL [A "pachy"] A "derm"
 -- SExpr (SAtom "pachy") (SAtom "derm")
+#if MIN_VERSION_base(4,8,0)
 pattern DL :: [SExpr a] -> a -> SExpr a
+#endif
 pattern DL xs x <- (gatherDList -> Just (xs, x))
 #if MIN_VERSION_base(4,8,0)
   where DL []     a = SAtom a

+ 10 - 0
Data/SCargot/Repr/Rich.hs

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

+ 8 - 0
Data/SCargot/Repr/WellFormed.hs

@@ -59,28 +59,36 @@ cons x (R.WFSList xs) = Just (R.WFSList (x:xs))
 --   instead.
 --
 -- >>> let sum (x ::: xs) = x + sum xs; sum Nil = 0
+#if MIN_VERSION_base(4,8,0)
 pattern (:::) :: WellFormedSExpr a -> WellFormedSExpr a -> WellFormedSExpr a
+#endif
 pattern x ::: xs <- (uncons -> Just (x, xs))
 
 -- | A shorter alias for `WFSList`
 --
 -- >>> L [A "pachy", A "derm"]
 -- WFSList [WFSAtom "pachy",WFSAtom "derm"]
+#if MIN_VERSION_base(4,8,0)
 pattern L :: [WellFormedSExpr t] -> WellFormedSExpr t
+#endif
 pattern L xs = R.WFSList xs
 
 -- | A shorter alias for `WFSAtom`
 --
 -- >>> A "elephant"
 -- WFSAtom "elephant"
+#if MIN_VERSION_base(4,8,0)
 pattern A :: t -> WellFormedSExpr t
+#endif
 pattern A a  = R.WFSAtom a
 
 -- | A shorter alias for `WFSList` @[]@
 --
 -- >>> Nil
 -- WFSList []
+#if MIN_VERSION_base(4,8,0)
 pattern Nil :: WellFormedSExpr t
+#endif
 pattern Nil = R.WFSList []
 
 getShape :: WellFormedSExpr a -> String