@@ -28,44 +28,44 @@ interface Eq a where
28 x /= y = not (x == y)
28 x /= y = not (x == y)
29 x == y = not (x /= y)
29 x == y = not (x /= y)
31−implementation Eq () where
31+Eq () where
32 () == () = True
32 () == () = True
34−implementation Eq Int where
34+Eq Int where
35 (==) = boolOp prim__eqInt
35 (==) = boolOp prim__eqInt
37−implementation Eq Integer where
37+Eq Integer where
38 (==) = boolOp prim__eqBigInt
38 (==) = boolOp prim__eqBigInt
40−implementation Eq Double where
40+Eq Double where
41 (==) = boolOp prim__eqFloat
41 (==) = boolOp prim__eqFloat
43−implementation Eq Char where
43+Eq Char where
44 (==) = boolOp prim__eqChar
44 (==) = boolOp prim__eqChar
46−implementation Eq String where
46+Eq String where
47 (==) = boolOp prim__eqString
47 (==) = boolOp prim__eqString
49−implementation Eq Ptr where
49+Eq Ptr where
50 (==) = boolOp prim__eqPtr
50 (==) = boolOp prim__eqPtr
52−implementation Eq ManagedPtr where
52+Eq ManagedPtr where
53 (==) = boolOp prim__eqManagedPtr
53 (==) = boolOp prim__eqManagedPtr
55−implementation Eq Bool where
55+Eq Bool where
56 True == True = True
56 True == True = True
57 True == False = False
57 True == False = False
58 False == True = False
58 False == True = False
59 False == False = True
59 False == False = True
61−implementation (Eq a, Eq b) => Eq (a, b) where
61+(Eq a, Eq b) => Eq (a, b) where
62 (==) (a, c) (b, d) = (a == b) && (c == d)
62 (==) (a, c) (b, d) = (a == b) && (c == d)
65-- ---------------------------------------------------------- [ Ordering Interface ]
65-- ---------------------------------------------------------- [ Ordering Interface ]
66%elim data Ordering = LT | EQ | GT
66%elim data Ordering = LT | EQ | GT
68−implementation Eq Ordering where
68+Eq Ordering where
69 LT == LT = True
69 LT == LT = True
70 EQ == EQ = True
70 EQ == EQ = True
71 GT == GT = True
71 GT == GT = True
@@ -103,47 +103,47 @@ interface Eq a => Ord a where
103 min : a -> a -> a
103 min : a -> a -> a
104 min x y = if (x < y) then x else y
104 min x y = if (x < y) then x else y
106−implementation Ord () where
106+Ord () where
107 compare () () = EQ
107 compare () () = EQ
109−implementation Ord Int where
109+Ord Int where
110 compare x y = if (x == y) then EQ else
110 compare x y = if (x == y) then EQ else
111 if (boolOp prim__sltInt x y) then LT else
111 if (boolOp prim__sltInt x y) then LT else
115−implementation Ord Integer where
115+Ord Integer where
116 compare x y = if (x == y) then EQ else
116 compare x y = if (x == y) then EQ else
117 if (boolOp prim__sltBigInt x y) then LT else
117 if (boolOp prim__sltBigInt x y) then LT else
121−implementation Ord Double where
121+Ord Double where
122 compare x y = if (x == y) then EQ else
122 compare x y = if (x == y) then EQ else
123 if (boolOp prim__sltFloat x y) then LT else
123 if (boolOp prim__sltFloat x y) then LT else
127−implementation Ord Char where
127+Ord Char where
128 compare x y = if (x == y) then EQ else
128 compare x y = if (x == y) then EQ else
129 if (boolOp prim__sltChar x y) then LT else
129 if (boolOp prim__sltChar x y) then LT else
133−implementation Ord String where
133+Ord String where
134 compare x y = if (x == y) then EQ else
134 compare x y = if (x == y) then EQ else
135 if (boolOp prim__ltString x y) then LT else
135 if (boolOp prim__ltString x y) then LT else
139−implementation Ord Bool where
139+Ord Bool where
140 compare True True = EQ
140 compare True True = EQ
141 compare False False = EQ
141 compare False False = EQ
142 compare False True = LT
142 compare False True = LT
143 compare True False = GT
143 compare True False = GT
146−implementation (Ord a, Ord b) => Ord (a, b) where
146+(Ord a, Ord b) => Ord (a, b) where
147 compare (xl, xr) (yl, yr) =
147 compare (xl, xr) (yl, yr) =
148 if xl /= yl
148 if xl /= yl
149 then compare xl yl
149 then compare xl yl
@@ -157,41 +157,41 @@ interface Num a where
157 ||| Conversion from Integer.
157 ||| Conversion from Integer.
158 fromInteger : Integer -> a
158 fromInteger : Integer -> a
160−implementation Num Integer where
160+Num Integer where
161 (+) = prim__addBigInt
161 (+) = prim__addBigInt
162 (*) = prim__mulBigInt
162 (*) = prim__mulBigInt
164 fromInteger = id
164 fromInteger = id
166−implementation Num Int where
166+Num Int where
167 (+) = prim__addInt
167 (+) = prim__addInt
168 (*) = prim__mulInt
168 (*) = prim__mulInt
170 fromInteger = prim__truncBigInt_Int
170 fromInteger = prim__truncBigInt_Int
173−implementation Num Double where
173+Num Double where
174 (+) = prim__addFloat
174 (+) = prim__addFloat
175 (*) = prim__mulFloat
175 (*) = prim__mulFloat
177 fromInteger = prim__toFloatBigInt
177 fromInteger = prim__toFloatBigInt
179−implementation Num Bits8 where
179+Num Bits8 where
180 (+) = prim__addB8
180 (+) = prim__addB8
181 (*) = prim__mulB8
181 (*) = prim__mulB8
182 fromInteger = prim__truncBigInt_B8
182 fromInteger = prim__truncBigInt_B8
184−implementation Num Bits16 where
184+Num Bits16 where
185 (+) = prim__addB16
185 (+) = prim__addB16
186 (*) = prim__mulB16
186 (*) = prim__mulB16
187 fromInteger = prim__truncBigInt_B16
187 fromInteger = prim__truncBigInt_B16
189−implementation Num Bits32 where
189+Num Bits32 where
190 (+) = prim__addB32
190 (+) = prim__addB32
191 (*) = prim__mulB32
191 (*) = prim__mulB32
192 fromInteger = prim__truncBigInt_B32
192 fromInteger = prim__truncBigInt_B32
194−implementation Num Bits64 where
194+Num Bits64 where
195 (+) = prim__addB64
195 (+) = prim__addB64
196 (*) = prim__mulB64
196 (*) = prim__mulB64
197 fromInteger = prim__truncBigInt_B64
197 fromInteger = prim__truncBigInt_B64
@@ -199,41 +199,41 @@ implementation Num Bits64 where
199-- --------------------------------------------------------- [ Negatable Interface ]
199-- --------------------------------------------------------- [ Negatable Interface ]
200||| The `Neg` interface defines operations on numbers which can be negative.
200||| The `Neg` interface defines operations on numbers which can be negative.
201interface Num a => Neg a where
201interface Num a => Neg a where
202− ||| The underlying implementation of unary minus. `-5` desugars to `negate (fromInteger 5)`.
202+ ||| The underlying of unary minus. `-5` desugars to `negate (fromInteger 5)`.
203 negate : a -> a
203 negate : a -> a
204 (-) : a -> a -> a
204 (-) : a -> a -> a
205 ||| Absolute value
205 ||| Absolute value
206 abs : a -> a
206 abs : a -> a
208−implementation Neg Integer where
208+Neg Integer where
209 negate x = prim__subBigInt 0 x
209 negate x = prim__subBigInt 0 x
210 (-) = prim__subBigInt
210 (-) = prim__subBigInt
211 abs x = if x < 0 then -x else x
211 abs x = if x < 0 then -x else x
213−implementation Neg Int where
213+Neg Int where
214 negate x = prim__subInt 0 x
214 negate x = prim__subInt 0 x
215 (-) = prim__subInt
215 (-) = prim__subInt
216 abs x = if x < (prim__truncBigInt_Int 0) then -x else x
216 abs x = if x < (prim__truncBigInt_Int 0) then -x else x
218−implementation Neg Double where
218+Neg Double where
219 negate x = prim__negFloat x
219 negate x = prim__negFloat x
220 (-) = prim__subFloat
220 (-) = prim__subFloat
221 abs x = if x < (prim__toFloatBigInt 0) then -x else x
221 abs x = if x < (prim__toFloatBigInt 0) then -x else x
223-- ------------------------------------------------------------
223-- ------------------------------------------------------------
224−implementation Eq Bits8 where
224+Eq Bits8 where
225 x == y = intToBool (prim__eqB8 x y)
225 x == y = intToBool (prim__eqB8 x y)
227−implementation Eq Bits16 where
227+Eq Bits16 where
228 x == y = intToBool (prim__eqB16 x y)
228 x == y = intToBool (prim__eqB16 x y)
230−implementation Eq Bits32 where
230+Eq Bits32 where
231 x == y = intToBool (prim__eqB32 x y)
231 x == y = intToBool (prim__eqB32 x y)
233−implementation Eq Bits64 where
233+Eq Bits64 where
234 x == y = intToBool (prim__eqB64 x y)
234 x == y = intToBool (prim__eqB64 x y)
236−implementation Ord Bits8 where
236+Ord Bits8 where
237 (<) = boolOp prim__ltB8
237 (<) = boolOp prim__ltB8
238 (>) = boolOp prim__gtB8
238 (>) = boolOp prim__gtB8
239 (<=) = boolOp prim__lteB8
239 (<=) = boolOp prim__lteB8
@@ -242,7 +242,7 @@ implementation Ord Bits8 where
242 else if l > r then GT
242 else if l > r then GT
245−implementation Ord Bits16 where
245+Ord Bits16 where
246 (<) = boolOp prim__ltB16
246 (<) = boolOp prim__ltB16
247 (>) = boolOp prim__gtB16
247 (>) = boolOp prim__gtB16
248 (<=) = boolOp prim__lteB16
248 (<=) = boolOp prim__lteB16
@@ -251,7 +251,7 @@ implementation Ord Bits16 where
251 else if l > r then GT
251 else if l > r then GT
254−implementation Ord Bits32 where
254+Ord Bits32 where
255 (<) = boolOp prim__ltB32
255 (<) = boolOp prim__ltB32
256 (>) = boolOp prim__gtB32
256 (>) = boolOp prim__gtB32
257 (<=) = boolOp prim__lteB32
257 (<=) = boolOp prim__lteB32
@@ -260,7 +260,7 @@ implementation Ord Bits32 where
260 else if l > r then GT
260 else if l > r then GT
263−implementation Ord Bits64 where
263+Ord Bits64 where
264 (<) = boolOp prim__ltB64
264 (<) = boolOp prim__ltB64
265 (>) = boolOp prim__gtB64
265 (>) = boolOp prim__gtB64
266 (<=) = boolOp prim__lteB64
266 (<=) = boolOp prim__lteB64
@@ -279,28 +279,28 @@ interface Ord b => MaxBound b where
279 ||| The upper bound for the type
279 ||| The upper bound for the type
280 maxBound : b
280 maxBound : b
282−implementation MinBound Bits8 where
282+MinBound Bits8 where
283 minBound = 0x0
283 minBound = 0x0
285−implementation MaxBound Bits8 where
285+MaxBound Bits8 where
286 maxBound = 0xff
286 maxBound = 0xff
288−implementation MinBound Bits16 where
288+MinBound Bits16 where
289 minBound = 0x0
289 minBound = 0x0
291−implementation MaxBound Bits16 where
291+MaxBound Bits16 where
292 maxBound = 0xffff
292 maxBound = 0xffff
294−implementation MinBound Bits32 where
294+MinBound Bits32 where
295 minBound = 0x0
295 minBound = 0x0
297−implementation MaxBound Bits32 where
297+MaxBound Bits32 where
298 maxBound = 0xffffffff
298 maxBound = 0xffffffff
300−implementation MinBound Bits64 where
300+MinBound Bits64 where
301 minBound = 0x0
301 minBound = 0x0
303−implementation MaxBound Bits64 where
303+MaxBound Bits64 where
304 maxBound = 0xffffffffffffffff
304 maxBound = 0xffffffffffffffff
@@ -327,7 +327,7 @@ modBigInt : Integer -> Integer -> Integer
327modBigInt x y = case y == 0 of
327modBigInt x y = case y == 0 of
328 False => prim__sremBigInt x y
328 False => prim__sremBigInt x y
330−implementation Integral Integer where
330+Integral Integer where
331 div = divBigInt
331 div = divBigInt
332 mod = modBigInt
332 mod = modBigInt
@@ -341,7 +341,7 @@ modInt : Int -> Int -> Int
341modInt x y = case y == 0 of
341modInt x y = case y == 0 of
342 False => prim__sremInt x y
342 False => prim__sremInt x y
344−implementation Integral Int where
344+Integral Int where
345 div = divInt
345 div = divInt
346 mod = modInt
346 mod = modInt
@@ -354,7 +354,7 @@ modB8 : Bits8 -> Bits8 -> Bits8
354modB8 x y = case y == 0 of
354modB8 x y = case y == 0 of
355 False => prim__sremB8 x y
355 False => prim__sremB8 x y
357−implementation Integral Bits8 where
357+Integral Bits8 where
358 div = divB8
358 div = divB8
359 mod = modB8
359 mod = modB8
@@ -367,7 +367,7 @@ modB16 : Bits16 -> Bits16 -> Bits16
367modB16 x y = case y == 0 of
367modB16 x y = case y == 0 of
368 False => prim__sremB16 x y
368 False => prim__sremB16 x y
370−implementation Integral Bits16 where
370+Integral Bits16 where
371 div = divB16
371 div = divB16
372 mod = modB16
372 mod = modB16
@@ -380,7 +380,7 @@ modB32 : Bits32 -> Bits32 -> Bits32
380modB32 x y = case y == 0 of
380modB32 x y = case y == 0 of
381 False => prim__sremB32 x y
381 False => prim__sremB32 x y
383−implementation Integral Bits32 where
383+Integral Bits32 where
384 div = divB32
384 div = divB32
385 mod = modB32
385 mod = modB32
@@ -393,7 +393,7 @@ modB64 : Bits64 -> Bits64 -> Bits64
393modB64 x y = case y == 0 of
393modB64 x y = case y == 0 of
394 False => prim__sremB64 x y
394 False => prim__sremB64 x y
396−implementation Integral Bits64 where
396+Integral Bits64 where
397 div = divB64
397 div = divB64
398 mod = modB64
398 mod = modB64