Version guards for GHC 7.8
Getty Ritter
8 years ago
| 88 | 88 | -- |
| 89 | 89 | -- >>> A "pachy" ::: A "derm" |
| 90 | 90 | -- SCons (SAtom "pachy") (SAtom "derm") |
| 91 | #if MIN_VERSION_base(4,8,0) | |
| 91 | 92 | pattern (:::) :: SExpr a -> SExpr a -> SExpr a |
| 93 | #endif | |
| 92 | 94 | pattern x ::: xs = SCons x xs |
| 93 | 95 | |
| 94 | 96 | -- | A shorter alias for `SAtom` |
| 95 | 97 | -- |
| 96 | 98 | -- >>> A "elephant" |
| 97 | 99 | -- SAtom "elephant" |
| 100 | #if MIN_VERSION_base(4,8,0) | |
| 98 | 101 | pattern A :: a -> SExpr a |
| 102 | #endif | |
| 99 | 103 | pattern A x = SAtom x |
| 100 | 104 | |
| 101 | 105 | -- | A (slightly) shorter alias for `SNil` |
| 102 | 106 | -- |
| 103 | 107 | -- >>> Nil |
| 104 | 108 | -- SNil |
| 109 | #if MIN_VERSION_base(4,8,0) | |
| 105 | 110 | pattern Nil :: SExpr a |
| 111 | #endif | |
| 106 | 112 | pattern Nil = SNil |
| 107 | 113 | |
| 108 | 114 | -- | An alias for matching a proper list. |
| 109 | 115 | -- |
| 110 | 116 | -- >>> L [A "pachy", A "derm"] |
| 111 | 117 | -- SExpr (SAtom "pachy") (SExpr (SAtom "derm") SNil) |
| 118 | #if MIN_VERSION_base(4,8,0) | |
| 112 | 119 | pattern L :: [SExpr a] -> SExpr a |
| 120 | #endif | |
| 113 | 121 | pattern L xs <- (gatherList -> Right xs) |
| 114 | 122 | #if MIN_VERSION_base(4,8,0) |
| 115 | 123 | where L [] = SNil |
| 121 | 129 | -- |
| 122 | 130 | -- >>> DL [A "pachy"] A "derm" |
| 123 | 131 | -- SExpr (SAtom "pachy") (SAtom "derm") |
| 132 | #if MIN_VERSION_base(4,8,0) | |
| 124 | 133 | pattern DL :: [SExpr a] -> a -> SExpr a |
| 134 | #endif | |
| 125 | 135 | pattern DL xs x <- (gatherDList -> Just (xs, x)) |
| 126 | 136 | #if MIN_VERSION_base(4,8,0) |
| 127 | 137 | where DL [] a = SAtom a |
| 107 | 107 | -- |
| 108 | 108 | -- >>> A "one" ::: L [A "two", A "three"] |
| 109 | 109 | -- RSList [RSAtom "one",RSAtom "two",RSAtom "three"] |
| 110 | #if MIN_VERSION_base(4,8,0) | |
| 110 | 111 | pattern (:::) :: RichSExpr a -> RichSExpr a -> RichSExpr a |
| 112 | #endif | |
| 111 | 113 | pattern x ::: xs <- (uncons -> Just (x, xs)) |
| 112 | 114 | #if MIN_VERSION_base(4,8,0) |
| 113 | 115 | where x ::: xs = cons x xs |
| 117 | 119 | -- |
| 118 | 120 | -- >>> A "elephant" |
| 119 | 121 | -- RSAtom "elephant" |
| 122 | #if MIN_VERSION_base(4,8,0) | |
| 120 | 123 | pattern A :: a -> RichSExpr a |
| 124 | #endif | |
| 121 | 125 | pattern A a = R.RSAtom a |
| 122 | 126 | |
| 123 | 127 | -- | A shorter alias for `RSList` |
| 124 | 128 | -- |
| 125 | 129 | -- >>> L [A "pachy", A "derm"] |
| 126 | 130 | -- RSList [RSAtom "pachy",RSAtom "derm"] |
| 131 | #if MIN_VERSION_base(4,8,0) | |
| 127 | 132 | pattern L :: [RichSExpr a] -> RichSExpr a |
| 133 | #endif | |
| 128 | 134 | pattern L xs = R.RSList xs |
| 129 | 135 | |
| 130 | 136 | -- | A shorter alias for `RSDotted` |
| 131 | 137 | -- |
| 132 | 138 | -- >>> DL [A "pachy"] "derm" |
| 133 | 139 | -- RSDotted [RSAtom "pachy"] "derm" |
| 140 | #if MIN_VERSION_base(4,8,0) | |
| 134 | 141 | pattern DL :: [RichSExpr a] -> a -> RichSExpr a |
| 142 | #endif | |
| 135 | 143 | pattern DL xs x = R.RSDotted xs x |
| 136 | 144 | |
| 137 | 145 | -- | A shorter alias for `RSList` @[]@ |
| 138 | 146 | -- |
| 139 | 147 | -- >>> Nil |
| 140 | 148 | -- RSList [] |
| 149 | #if MIN_VERSION_base(4,8,0) | |
| 141 | 150 | pattern Nil :: RichSExpr a |
| 151 | #endif | |
| 142 | 152 | pattern Nil = R.RSList [] |
| 143 | 153 | |
| 144 | 154 | -- | Utility function for parsing a pair of things: this parses a two-element list, |
| 59 | 59 | -- instead. |
| 60 | 60 | -- |
| 61 | 61 | -- >>> let sum (x ::: xs) = x + sum xs; sum Nil = 0 |
| 62 | #if MIN_VERSION_base(4,8,0) | |
| 62 | 63 | pattern (:::) :: WellFormedSExpr a -> WellFormedSExpr a -> WellFormedSExpr a |
| 64 | #endif | |
| 63 | 65 | pattern x ::: xs <- (uncons -> Just (x, xs)) |
| 64 | 66 | |
| 65 | 67 | -- | A shorter alias for `WFSList` |
| 66 | 68 | -- |
| 67 | 69 | -- >>> L [A "pachy", A "derm"] |
| 68 | 70 | -- WFSList [WFSAtom "pachy",WFSAtom "derm"] |
| 71 | #if MIN_VERSION_base(4,8,0) | |
| 69 | 72 | pattern L :: [WellFormedSExpr t] -> WellFormedSExpr t |
| 73 | #endif | |
| 70 | 74 | pattern L xs = R.WFSList xs |
| 71 | 75 | |
| 72 | 76 | -- | A shorter alias for `WFSAtom` |
| 73 | 77 | -- |
| 74 | 78 | -- >>> A "elephant" |
| 75 | 79 | -- WFSAtom "elephant" |
| 80 | #if MIN_VERSION_base(4,8,0) | |
| 76 | 81 | pattern A :: t -> WellFormedSExpr t |
| 82 | #endif | |
| 77 | 83 | pattern A a = R.WFSAtom a |
| 78 | 84 | |
| 79 | 85 | -- | A shorter alias for `WFSList` @[]@ |
| 80 | 86 | -- |
| 81 | 87 | -- >>> Nil |
| 82 | 88 | -- WFSList [] |
| 89 | #if MIN_VERSION_base(4,8,0) | |
| 83 | 90 | pattern Nil :: WellFormedSExpr t |
| 91 | #endif | |
| 84 | 92 | pattern Nil = R.WFSList [] |
| 85 | 93 | |
| 86 | 94 | getShape :: WellFormedSExpr a -> String |