[remove special handling and magic instantiation of bounded, eq, and ord for primitive integral types
John Meacham <john@repetae.net>**20100705072355
 Ignore-this: f0fd0f01ac880a899bd3d541272288a0
] addfile ./lib/jhc/Jhc/Enum.m4
addfile ./lib/jhc/Jhc/Inst/Order.hs
hunk ./lib/jhc/Jhc/Enum.hs 1
-{-# OPTIONS_JHC -N -fffi -funboxed-values #-}
+{-# OPTIONS_JHC -fm4 -N -fffi -funboxed-values #-}
hunk ./lib/jhc/Jhc/Enum.hs 12
+m4_include(Jhc/Enum.m4)
+
hunk ./lib/jhc/Jhc/Enum.hs 89
+BOUNDED(Int)
+BOUNDED(Integer)
+
hunk ./lib/jhc/Jhc/Enum.m4 1
+m4_divert(-1)
+m4_dnl simple macros for defining instances for classes in Jhc.Enum
+
+m4_define(ENUMINST,{{
+instance Enum $1 where
+    toEnum = fromInt
+    fromEnum = toInt
+    succ = increment$1
+    pred = decrement$1
+    enumFrom c        = [c .. maxBound]
+    enumFromThen c c' = last `seq` [c, c' .. last]
+                      where last | c' < c    = minBound
+                                 | otherwise = maxBound
+    enumFromTo x y = f x where
+        f x | x > y = []
+            | otherwise = x:f (x + 1)
+    enumFromThenTo x y z | y >= x = inc `seq` z `seq` f x where
+        inc = y - x
+        f x | x <= z = x:f (x + inc)
+            | otherwise = []
+    enumFromThenTo x y z  = dec `seq` z `seq` f x where
+        dec = x - y
+        f x | x >= z = x:f (x - dec)
+            | otherwise = []
+
+foreign import primitive "increment" increment$1 :: $1 -> $1
+foreign import primitive "decrement" decrement$1 :: $1 -> $1
+
+}})
+
+m4_define(BOUNDED,{{
+instance Bounded $1 where
+    maxBound = maxBound$1
+    minBound = minBound$1
+
+foreign import primitive "maxBound" maxBound$1 :: $1
+foreign import primitive "minBound" minBound$1 :: $1
+}})
+
+m4_define(UBOUNDED,{{
+instance Bounded $1 where
+    maxBound = umaxBound$1
+    minBound = zero$1
+
+foreign import primitive "umaxBound" umaxBound$1 :: $1
+foreign import primitive "zero" zero$1 :: $1
+
+}})
+
+
+
+
+m4_divert
hunk ./lib/jhc/Jhc/Inst/Enum.hs 12
+import Jhc.Inst.Order
hunk ./lib/jhc/Jhc/Inst/Enum.hs 14
-m4_define(ENUMINST,{{
-instance Enum $1 where
-    toEnum = fromInt
-    fromEnum = toInt
-    succ = increment$1
-    pred = decrement$1
-    enumFrom c        = [c .. maxBound]
-    enumFromThen c c' = last `seq` [c, c' .. last]
-                      where last | c' < c    = minBound
-                                 | otherwise = maxBound
-    enumFromTo x y = f x where
-        f x | x > y = []
-            | otherwise = x:f (x + 1)
-    enumFromThenTo x y z | y >= x = inc `seq` z `seq` f x where
-        inc = y - x
-        f x | x <= z = x:f (x + inc)
-            | otherwise = []
-    enumFromThenTo x y z  = dec `seq` z `seq` f x where
-        dec = x - y
-        f x | x >= z = x:f (x - dec)
-            | otherwise = []
-
-foreign import primitive "increment" increment$1 :: $1 -> $1
-foreign import primitive "decrement" decrement$1 :: $1 -> $1
-
-}})
+m4_include(Jhc/Enum.m4)
hunk ./lib/jhc/Jhc/Inst/Enum.hs 24
+UBOUNDED(Word)
+UBOUNDED(Word8)
+UBOUNDED(Word16)
+UBOUNDED(Word32)
+UBOUNDED(Word64)
+UBOUNDED(WordPtr)
+UBOUNDED(WordMax)
+
hunk ./lib/jhc/Jhc/Inst/Enum.hs 40
+BOUNDED(Int8)
+BOUNDED(Int16)
+BOUNDED(Int32)
+BOUNDED(Int64)
+BOUNDED(IntPtr)
+BOUNDED(IntMax)
hunk ./lib/jhc/Jhc/Inst/Order.hs 1
+{-# OPTIONS_JHC -fm4 -N -fffi #-}
+module Jhc.Inst.Order() where
+
+
+m4_include(Jhc/Order.m4)
+
+import Data.Word
+import Data.Int
+import Jhc.Order
+import Jhc.Prim
+import Foreign.C.Types
+
+INST_EQORDER(Int8,,Int8,)
+INST_EQORDER(Int16,,Int16,)
+INST_EQORDER(Int32,,Int32,)
+INST_EQORDER(Int64,,Int64,)
+INST_EQORDER(IntPtr,,IntPtr,)
+INST_EQORDER(IntMax,,IntMax,)
+
+INST_EQORDER(Word,,Word,U)
+INST_EQORDER(Word8,,Word8,U)
+INST_EQORDER(Word16,,Word16,U)
+INST_EQORDER(Word32,,Word32,U)
+INST_EQORDER(Word64,,Word64,U)
+INST_EQORDER(WordPtr,,WordPtr,U)
+INST_EQORDER(WordMax,,WordMax,U)
+
+
+INST_EQORDER(CChar,,CChar,)
+INST_EQORDER(CWchar,,CWchar,)
+INST_EQORDER(CInt,,CInt,)
+INST_EQORDER(CSize,,CSize,)
hunk ./lib/jhc/Jhc/Inst/Show.hs 5
+import Jhc.Inst.Order
hunk ./lib/jhc/Jhc/Order.hs 102
+INST_EQORDER(Int,,Int,)
+INST_EQORDER(Integer,,Integer,)
hunk ./lib/jhc/Jhc/Order.m4 38
+m4_define(BOUNDED,{{
+instance Bounded $1 where
+    maxBound = maxBound$1
+    minBound = minBound$1
+
+foreign import primitive "maxBound" maxBound$1 :: $1
+foreign import primitive "minBound" minBound$1 :: $1
+
+}})
+
+m4_define(UBOUNDED,{{
+instance Bounded $1 where
+    maxBound = umaxBound$1
+    minBound = zero$1
+
+foreign import primitive "umaxBound" umaxBound$1 :: $1
+foreign import primitive "zero" zero$1 :: $1
+
+}})
+
+
hunk ./lib/jhc/Prelude/CType.hs 9
+import Jhc.Inst.Order
hunk ./lib/jhc/Prelude.hs 69
+import Jhc.Inst.Order
hunk ./src/data/operators.txt 4
-[int,float,char,ptr]
-aaB, ==, Jhc.Order.Eq, ==
+# [int,float,char,ptr]
+# aaB, ==, Jhc.Order.Eq, ==
hunk ./src/data/operators.txt 7
-aaB, >=, Jhc.Order.Ord, >=
-aaB, <=, Jhc.Order.Ord, <=
-aaB, >, Jhc.Order.Ord, >
-aaB, <, Jhc.Order.Ord, <
+# aaB, >=, Jhc.Order.Ord, >=
+# aaB, <=, Jhc.Order.Ord, <=
+# aaB, >, Jhc.Order.Ord, >
+# aaB, <, Jhc.Order.Ord, <
hunk ./utils/op_process.prl 190
-    my $prelude_bounded = hsname("Jhc.Enum.Bounded");
+#    my $prelude_bounded = hsname("Jhc.Enum.Bounded");
hunk ./utils/op_process.prl 193
-    push @inst, "[] :=> IsIn $prelude_bounded $tycon" if $vtype ne 'f';
+#    push @inst, "[] :=> IsIn $prelude_bounded $tycon" if $vtype ne 'f';
hunk ./utils/op_process.prl 198
-    push @cmeth, "($prelude_bounded, toInstName \"Jhc.Enum.maxBound.$d->[0]\", " . "prim_${vtype}maxbound $cncons $t \"$d->[1]\")" if $vtype ne 'f';;
-    push @cmeth, "($prelude_bounded, toInstName \"Jhc.Enum.minBound.$d->[0]\", " . "prim_${vtype}minbound $cncons $t \"$d->[1]\")" if $vtype ne 'f';;
+#    push @cmeth, "($prelude_bounded, toInstName \"Jhc.Enum.maxBound.$d->[0]\", " . "prim_${vtype}maxbound $cncons $t \"$d->[1]\")" if $vtype ne 'f';;
+#    push @cmeth, "($prelude_bounded, toInstName \"Jhc.Enum.minBound.$d->[0]\", " . "prim_${vtype}minbound $cncons $t \"$d->[1]\")" if $vtype ne 'f';;