Restore old names of comparison primops
[ghc.git] / compiler / utils / ExtsCompat46.hs
1 {-# LANGUAGE BangPatterns, CPP #-}
2
3 -----------------------------------------------------------------------------
4 -- |
5 -- Module : ExtsCompat46
6 -- Copyright : (c) Lodz University of Technology 2013
7 -- License : see LICENSE
8 --
9 -- Maintainer : ghc-devs@haskell.org
10 -- Stability : internal
11 -- Portability : non-portable (GHC internal)
12 --
13 -- Compatibility module to encapsulate primops API change between GHC 7.6
14 -- GHC 7.8.
15 --
16 -- In GHC we use comparison primops in a couple of modules, but that primops
17 -- have different type signature in GHC 7.6 (where they return Bool) than
18 -- in GHC 7.8 (where they return Int#). As long as we allow bootstrapping
19 -- with GHC 7.6 or earlier we need to have this compatibility module, so that
20 -- we can compile stage1 compiler using the old API and then continue with
21 -- stage2 using the new API. When we set GHC 7.8 as the minimum version
22 -- required for bootstrapping, we should remove this module.
23 --
24 -----------------------------------------------------------------------------
25
26 module ExtsCompat46 (
27 module GHC.Exts,
28
29 gtChar#, geChar#, eqChar#,
30 neChar#, ltChar#, leChar#,
31
32 (>#), (>=#), (==#), (/=#), (<#), (<=#),
33
34 gtWord#, geWord#, eqWord#,
35 neWord#, ltWord#, leWord#,
36
37 (>##), (>=##), (==##), (/=##), (<##), (<=##),
38
39 gtFloat#, geFloat#, eqFloat#,
40 neFloat#, ltFloat#, leFloat#,
41
42 gtAddr#, geAddr#, eqAddr#,
43 neAddr#, ltAddr#, leAddr#,
44
45 sameMutableArray#, sameMutableByteArray#, sameMutableArrayArray#,
46 sameMutVar#, sameTVar#, sameMVar#
47
48 ) where
49
50 import GHC.Exts hiding (
51 gtChar#, geChar#, eqChar#,
52 neChar#, ltChar#, leChar#,
53
54 (>#), (>=#), (==#), (/=#), (<#), (<=#),
55
56 gtWord#, geWord#, eqWord#,
57 neWord#, ltWord#, leWord#,
58
59 (>##), (>=##), (==##), (/=##), (<##), (<=##),
60
61 gtFloat#, geFloat#, eqFloat#,
62 neFloat#, ltFloat#, leFloat#,
63
64 gtAddr#, geAddr#, eqAddr#,
65 neAddr#, ltAddr#, leAddr#,
66
67 sameMutableArray#, sameMutableByteArray#, sameMutableArrayArray#,
68 sameMutVar#, sameTVar#, sameMVar#
69 )
70
71 import qualified GHC.Exts as E (
72 gtChar#, geChar#, eqChar#,
73 neChar#, ltChar#, leChar#,
74
75 (>#), (>=#), (==#), (/=#), (<#), (<=#),
76
77 gtWord#, geWord#, eqWord#,
78 neWord#, ltWord#, leWord#,
79
80 (>##), (>=##), (==##), (/=##), (<##), (<=##),
81
82 gtFloat#, geFloat#, eqFloat#,
83 neFloat#, ltFloat#, leFloat#,
84
85 gtAddr#, geAddr#, eqAddr#,
86 neAddr#, ltAddr#, leAddr#,
87
88 sameMutableArray#, sameMutableByteArray#, sameMutableArrayArray#,
89 sameMutVar#, sameTVar#, sameMVar#
90 )
91
92 #if __GLASGOW_HASKELL__ > 710
93 #error What is minimal version of GHC required for bootstraping? If it's GHC 7.8 we should remove this module and use GHC.Exts instead.
94 #endif
95
96 #if __GLASGOW_HASKELL__ > 706
97
98 gtChar# :: Char# -> Char# -> Bool
99 gtChar# a b = isTrue# (a `E.gtChar#` b)
100 geChar# :: Char# -> Char# -> Bool
101 geChar# a b = isTrue# (a `E.geChar#` b)
102 eqChar# :: Char# -> Char# -> Bool
103 eqChar# a b = isTrue# (a `E.eqChar#` b)
104 neChar# :: Char# -> Char# -> Bool
105 neChar# a b = isTrue# (a `E.neChar#` b)
106 ltChar# :: Char# -> Char# -> Bool
107 ltChar# a b = isTrue# (a `E.ltChar#` b)
108 leChar# :: Char# -> Char# -> Bool
109 leChar# a b = isTrue# (a `E.leChar#` b)
110
111 infix 4 >#, >=#, ==#, /=#, <#, <=#
112
113 (>#) :: Int# -> Int# -> Bool
114 (>#) a b = isTrue# (a E.># b)
115 (>=#) :: Int# -> Int# -> Bool
116 (>=#) a b = isTrue# (a E.>=# b)
117 (==#) :: Int# -> Int# -> Bool
118 (==#) a b = isTrue# (a E.==# b)
119 (/=#) :: Int# -> Int# -> Bool
120 (/=#) a b = isTrue# (a E./=# b)
121 (<#) :: Int# -> Int# -> Bool
122 (<#) a b = isTrue# (a E.<# b)
123 (<=#) :: Int# -> Int# -> Bool
124 (<=#) a b = isTrue# (a E.<=# b)
125
126 gtWord# :: Word# -> Word# -> Bool
127 gtWord# a b = isTrue# (a `E.gtWord#` b)
128 geWord# :: Word# -> Word# -> Bool
129 geWord# a b = isTrue# (a `E.geWord#` b)
130 eqWord# :: Word# -> Word# -> Bool
131 eqWord# a b = isTrue# (a `E.eqWord#` b)
132 neWord# :: Word# -> Word# -> Bool
133 neWord# a b = isTrue# (a `E.neWord#` b)
134 ltWord# :: Word# -> Word# -> Bool
135 ltWord# a b = isTrue# (a `E.ltWord#` b)
136 leWord# :: Word# -> Word# -> Bool
137 leWord# a b = isTrue# (a `E.leWord#` b)
138
139 infix 4 >##, >=##, ==##, /=##, <##, <=##
140
141 (>##) :: Double# -> Double# -> Bool
142 (>##) a b = isTrue# (a E.>## b)
143 (>=##) :: Double# -> Double# -> Bool
144 (>=##) a b = isTrue# (a E.>=## b)
145 (==##) :: Double# -> Double# -> Bool
146 (==##) a b = isTrue# (a E.==## b)
147 (/=##) :: Double# -> Double# -> Bool
148 (/=##) a b = isTrue# (a E./=## b)
149 (<##) :: Double# -> Double# -> Bool
150 (<##) a b = isTrue# (a E.<## b)
151 (<=##) :: Double# -> Double# -> Bool
152 (<=##) a b = isTrue# (a E.<=## b)
153
154 gtFloat# :: Float# -> Float# -> Bool
155 gtFloat# a b = isTrue# (a `E.gtFloat#` b)
156 geFloat# :: Float# -> Float# -> Bool
157 geFloat# a b = isTrue# (a `E.geFloat#` b)
158 eqFloat# :: Float# -> Float# -> Bool
159 eqFloat# a b = isTrue# (a `E.eqFloat#` b)
160 neFloat# :: Float# -> Float# -> Bool
161 neFloat# a b = isTrue# (a `E.neFloat#` b)
162 ltFloat# :: Float# -> Float# -> Bool
163 ltFloat# a b = isTrue# (a `E.ltFloat#` b)
164 leFloat# :: Float# -> Float# -> Bool
165 leFloat# a b = isTrue# (a `E.leFloat#` b)
166
167 gtAddr# :: Addr# -> Addr# -> Bool
168 gtAddr# a b = isTrue# (a `E.gtAddr#` b)
169 geAddr# :: Addr# -> Addr# -> Bool
170 geAddr# a b = isTrue# (a `E.geAddr#` b)
171 eqAddr# :: Addr# -> Addr# -> Bool
172 eqAddr# a b = isTrue# (a `E.eqAddr#` b)
173 neAddr# :: Addr# -> Addr# -> Bool
174 neAddr# a b = isTrue# (a `E.neAddr#` b)
175 ltAddr# :: Addr# -> Addr# -> Bool
176 ltAddr# a b = isTrue# (a `E.ltAddr#` b)
177 leAddr# :: Addr# -> Addr# -> Bool
178 leAddr# a b = isTrue# (a `E.leAddr#` b)
179
180 sameMutableArray# :: MutableArray# s a -> MutableArray# s a -> Bool
181 sameMutableArray# a b = isTrue# (E.sameMutableArray# a b)
182 sameMutableByteArray# :: MutableByteArray# s -> MutableByteArray# s -> Bool
183 sameMutableByteArray# a b = isTrue# (E.sameMutableByteArray# a b)
184 sameMutableArrayArray# :: MutableArrayArray# s -> MutableArrayArray# s -> Bool
185 sameMutableArrayArray# a b = isTrue# (E.sameMutableArrayArray# a b)
186
187 sameMutVar# :: MutVar# s a -> MutVar# s a -> Bool
188 sameMutVar# a b = isTrue# (E.sameMutVar# a b)
189 sameTVar# :: TVar# s a -> TVar# s a -> Bool
190 sameTVar# a b = isTrue# (E.sameTVar# a b)
191 sameMVar# :: MVar# s a -> MVar# s a -> Bool
192 sameMVar# a b = isTrue# (E.sameMVar# a b)
193
194 #else
195
196 gtChar# :: Char# -> Char# -> Bool
197 gtChar# a b = a `E.gtChar#` b
198 geChar# :: Char# -> Char# -> Bool
199 geChar# a b = a `E.geChar#` b
200 eqChar# :: Char# -> Char# -> Bool
201 eqChar# a b = a `E.eqChar#` b
202 neChar# :: Char# -> Char# -> Bool
203 neChar# a b = a `E.neChar#` b
204 ltChar# :: Char# -> Char# -> Bool
205 ltChar# a b = a `E.ltChar#` b
206 leChar# :: Char# -> Char# -> Bool
207 leChar# a b = a `E.leChar#` b
208
209 infix 4 >#, >=#, ==#, /=#, <#, <=#
210
211 (>#) :: Int# -> Int# -> Bool
212 (>#) a b = a E.># b
213 (>=#) :: Int# -> Int# -> Bool
214 (>=#) a b = a E.>=# b
215 (==#) :: Int# -> Int# -> Bool
216 (==#) a b = a E.==# b
217 (/=#) :: Int# -> Int# -> Bool
218 (/=#) a b = a E./=# b
219 (<#) :: Int# -> Int# -> Bool
220 (<#) a b = a E.<# b
221 (<=#) :: Int# -> Int# -> Bool
222 (<=#) a b = a E.<=# b
223
224 gtWord# :: Word# -> Word# -> Bool
225 gtWord# a b = a `E.gtWord#` b
226 geWord# :: Word# -> Word# -> Bool
227 geWord# a b = a `E.geWord#` b
228 eqWord# :: Word# -> Word# -> Bool
229 eqWord# a b = a `E.eqWord#` b
230 neWord# :: Word# -> Word# -> Bool
231 neWord# a b = a `E.neWord#` b
232 ltWord# :: Word# -> Word# -> Bool
233 ltWord# a b = a `E.ltWord#` b
234 leWord# :: Word# -> Word# -> Bool
235 leWord# a b = a `E.leWord#` b
236
237 infix 4 >##, >=##, ==##, /=##, <##, <=##
238
239 (>##) :: Double# -> Double# -> Bool
240 (>##) a b = a E.>## b
241 (>=##) :: Double# -> Double# -> Bool
242 (>=##) a b = a E.>=## b
243 (==##) :: Double# -> Double# -> Bool
244 (==##) a b = a E.==## b
245 (/=##) :: Double# -> Double# -> Bool
246 (/=##) a b = a E./=## b
247 (<##) :: Double# -> Double# -> Bool
248 (<##) a b = a E.<## b
249 (<=##) :: Double# -> Double# -> Bool
250 (<=##) a b = a E.<=## b
251
252 gtFloat# :: Float# -> Float# -> Bool
253 gtFloat# a b = a `E.gtFloat#` b
254 geFloat# :: Float# -> Float# -> Bool
255 geFloat# a b = a `E.geFloat#` b
256 eqFloat# :: Float# -> Float# -> Bool
257 eqFloat# a b = a `E.eqFloat#` b
258 neFloat# :: Float# -> Float# -> Bool
259 neFloat# a b = a `E.neFloat#` b
260 ltFloat# :: Float# -> Float# -> Bool
261 ltFloat# a b = a `E.ltFloat#` b
262 leFloat# :: Float# -> Float# -> Bool
263 leFloat# a b = a `E.leFloat#` b
264
265 gtAddr# :: Addr# -> Addr# -> Bool
266 gtAddr# a b = a `E.gtAddr#` b
267 geAddr# :: Addr# -> Addr# -> Bool
268 geAddr# a b = a `E.geAddr#` b
269 eqAddr# :: Addr# -> Addr# -> Bool
270 eqAddr# a b = a `E.eqAddr#` b
271 neAddr# :: Addr# -> Addr# -> Bool
272 neAddr# a b = a `E.neAddr#` b
273 ltAddr# :: Addr# -> Addr# -> Bool
274 ltAddr# a b = a `E.ltAddr#` b
275 leAddr# :: Addr# -> Addr# -> Bool
276 leAddr# a b = a `E.leAddr#` b
277
278 sameMutableArray# :: MutableArray# s a -> MutableArray# s a -> Bool
279 sameMutableArray# a b = E.sameMutableArray# a b
280 sameMutableByteArray# :: MutableByteArray# s -> MutableByteArray# s -> Bool
281 sameMutableByteArray# a b = E.sameMutableByteArray# a b
282 sameMutableArrayArray# :: MutableArrayArray# s -> MutableArrayArray# s -> Bool
283 sameMutableArrayArray# a b = E.sameMutableArrayArray# a b
284
285 sameMutVar# :: MutVar# s a -> MutVar# s a -> Bool
286 sameMutVar# a b = E.sameMutVar# a b
287 sameTVar# :: TVar# s a -> TVar# s a -> Bool
288 sameTVar# a b = E.sameTVar# a b
289 sameMVar# :: MVar# s a -> MVar# s a -> Bool
290 sameMVar# a b = E.sameMVar# a b
291
292 #endif