[rearrange libraries, create Jhc.Show and Jhc.Num to hold their respective classes
John Meacham <john@repetae.net>**20070306054741] hunk ./Name/Names.hs 64
-dc_Rational = toName DataConstructor ("Ratio",":%")
+dc_Rational = toName DataConstructor ("Jhc.Num",":%")
hunk ./Name/Names.hs 91
-tc_Ratio = toName TypeConstructor ("Ratio","Ratio")
+tc_Ratio = toName TypeConstructor ("Jhc.Num","Ratio")
hunk ./Name/Names.hs 109
-v_fail = toName Val ("Prelude","fail")
+v_fail = toName Val ("Jhc.Monad","fail")
hunk ./Name/Names.hs 122
-    func_fromInteger = toName Val ("Prelude","fromInteger"),
-    func_fromInt = toName Val ("Prelude","fromInt"),
-    func_fromRational = toName Val ("Prelude","fromRational"),
-    func_negate = toName Val ("Prelude","negate"),
+    func_fromInteger = toName Val ("Jhc.Num","fromInteger"),
+    func_fromInt = toName Val ("Jhc.Num","fromInt"),
+    func_fromRational = toName Val ("Jhc.Num","fromRational"),
+    func_negate = toName Val ("Jhc.Num","negate"),
hunk ./Name/Names.hs 154
-class_Show = toName ClassName ("Prelude.Text","Show")
+class_Show = toName ClassName ("Jhc.Show","Show")
hunk ./Name/Names.hs 159
-class_Num = toName ClassName ("Prelude","Num")
-class_Real = toName ClassName ("Prelude","Real")
-class_Integral = toName ClassName ("Prelude","Integral")
-class_Fractional = toName ClassName ("Prelude","Fractional")
+class_Num = toName ClassName ("Jhc.Num","Num")
+class_Real = toName ClassName ("Jhc.Num","Real")
+class_Integral = toName ClassName ("Jhc.Num","Integral")
+class_Fractional = toName ClassName ("Jhc.Num","Fractional")
hunk ./data/operators.txt 14
-aaa, +, Prelude.Num, +
-aaa, -, Prelude.Num, -
-aaa, *, Prelude.Num, *
-aa, negate, Prelude.Num, -
-# 1, abs, Prelude.Num, abs
-# 1, signum, Prelude.Num, abs
+aaa, +, Jhc.Num.Num, +
+aaa, -, Jhc.Num.Num, -
+aaa, *, Jhc.Num.Num, *
+aa, negate, Jhc.Num.Num, -
+# 1, abs, Jhc.Num.Num, abs
+# 1, signum, Jhc.Num.Num, abs
hunk ./data/operators.txt 26
-aaa, quot, Prelude.Integral, /
-aaa, rem, Prelude.Integral, %
-aaa, div, Prelude.Integral, /
-aaa, mod, Prelude.Integral, %
+aaa, quot, Jhc.Num.Integral, /
+aaa, rem, Jhc.Num.Integral, %
+aaa, div, Jhc.Num.Integral, /
+aaa, mod, Jhc.Num.Integral, %
hunk ./data/operators.txt 35
-# aaa, /, Prelude.Fractional, /
+# aaa, /, Jhc.Num.Fractional, /
hunk ./lib/base/Data/Bits.hs 1
+{-# OPTIONS_JHC -N #-}
hunk ./lib/base/Data/Bits.hs 5
+import Jhc.Num
+import Jhc.Order
+import Jhc.Int
+
hunk ./lib/base/Data/Ratio.hs 7
+import Jhc.Num
hunk ./lib/base/Data/Ratio.hs 13
-data  (Integral a)      => Ratio a = !a :% !a
-type  Rational          =  Ratio Integer
+numerator (x :% _)      =  x
+denominator (_ :% y)    =  y
+
hunk ./lib/base/Data/Ratio.hs 25
-numerator (x :% _)      =  x
-
-denominator (_ :% y)    =  y
-
addfile ./lib/base/Jhc/Num.hs
hunk ./lib/base/Jhc/Num.hs 1
+{-# OPTIONS_JHC -N #-}
+module Jhc.Num where
+
+import Jhc.Basics
+import Jhc.Order
+import Jhc.Show
+import Jhc.IO(error)
+import Jhc.Enum
+
+infixl 7  *  , /, `quot`, `rem`, `div`, `mod`
+infixl 6  +, -
+
+data  Ratio a  = !a :% !a
+type  Rational = Ratio Integer
+
+
+class  (Eq a, Show a) => Num a  where
+    (+), (-), (*)    :: a -> a -> a
+    negate           :: a -> a
+    abs, signum      :: a -> a
+    fromInteger      :: Integer -> a
+    fromInt          :: Int -> a
+
+        -- Minimal complete definition:
+        --      All, except negate or (-)
+    x - y            =  x + negate y
+    negate x         =  0 - x
+    fromInt i = fromInteger (toInteger i)
+    fromInteger x = fromInt (toInt x)
+
+class  (Num a, Ord a) => Real a  where
+    toRational       ::  a -> Rational
+
+class  (Real a, Enum a) => Integral a  where
+    quot, rem        :: a -> a -> a
+    div, mod         :: a -> a -> a
+    quotRem, divMod  :: a -> a -> (a,a)
+    toInteger        :: a -> Integer
+    toInt            :: a -> Int
+
+        -- Minimal complete definition:
+        --      quotRem, toInteger
+    n `quot` d       =  q  where (q,r) = quotRem n d
+    n `rem` d        =  r  where (q,r) = quotRem n d
+    n `div` d        =  q  where (q,r) = divMod n d
+    n `mod` d        =  r  where (q,r) = divMod n d
+    divMod n d       =  if signum r == - signum d then (q-1, r+d) else qr
+                        where qr@(q,r) = quotRem n d
+    quotRem n d       =  (n `quot` d, n `rem` d)
+    toInteger x = toInteger (toInt x)
+    toInt x = toInt (toInteger x)
+
+class  (Num a) => Fractional a  where
+    (/)              :: a -> a -> a
+    recip            :: a -> a
+    fromRational     :: Rational -> a
+
+        -- Minimal complete definition:
+        --      fromRational and (recip or (/))
+    recip x          =  1 / x
+    x / y            =  x * recip y
+
+
+fromIntegral     :: (Integral a, Num b) => a -> b
+fromIntegral     =  fromInteger . toInteger
+
+realToFrac     :: (Real a, Fractional b) => a -> b
+realToFrac      =  fromRational . toRational
+
+{-# RULES
+  "realToFrac/toRational"     realToFrac = toRational
+  "realToFrac/fromRational"   realToFrac = fromRational
+ #-}
+
+{-# RULES
+  "fromIntegral/Int"          fromIntegral = (id :: Int -> Int)
+  "fromIntegral/Integer"      fromIntegral = (id :: Integer -> Integer)
+  "fromIntegral/toInt"        fromIntegral = toInt
+  "fromIntegral/fromInt"      fromIntegral = fromInt
+  "fromIntegral/toInteger"    fromIntegral = toInteger
+  "fromIntegral/fromInteger"  fromIntegral = fromInteger
+ #-}
addfile ./lib/base/Jhc/Show.hs
hunk ./lib/base/Jhc/Show.hs 1
+{-# OPTIONS_JHC -N #-}
+module Jhc.Show where
+
+import Jhc.Int
+import Jhc.Order
+import Jhc.Basics
+
+type  ShowS    = String -> String
+
+class  Show a  where
+    showsPrec        :: Int -> a -> ShowS
+    show             :: a -> String
+    showList         :: [a] -> ShowS
+
+        -- Mimimal complete definition:
+        --      show or showsPrec
+    showsPrec _ x s   = show x ++ s
+
+    show x            = showsPrec zero x ""
+
+    showList []       = showString "[]"
+    showList (x:xs)   = showChar '[' . shows x . showl xs
+                        where showl []     = showChar ']'
+                              showl (x:xs) = showChar ',' . shows x .
+                                             showl xs
+
+shows            :: (Show a) => a -> ShowS
+shows            =  showsPrec zero
+
+{-# INLINE showChar, showString #-}
+showChar         :: Char -> ShowS
+showChar         =  (:)
+
+showString       :: String -> ShowS
+showString       =  (++)
+
+showParen        :: Bool -> ShowS -> ShowS
+showParen b p    =  if b then showChar '(' . p . showChar ')' else p
+
+
+instance Show () where
+    showsPrec _ () = showString "()"
+
+instance (Show a, Show b) => Show (a,b)  where
+    showsPrec _ (x,y) = showChar '(' . shows x . showChar ',' .
+                                          shows y . showChar ')'
+
+instance (Show a, Show b, Show c) => Show (a, b, c) where
+    showsPrec _ (x,y,z) = showChar '(' . shows x . showChar ',' .
+					    shows y . showChar ',' .
+					    shows z . showChar ')'
+
+instance Show a => Show [a]  where
+    showsPrec p      = showList
+
+
+instance Show Bool where
+    showsPrec d (False) = showString "False"
+    showsPrec d (True) = showString "True"
+
+
+instance Show Ordering where
+    showsPrec d (LT) = showString "LT"
+    showsPrec d (EQ) = showString "EQ"
+    showsPrec d (GT) = showString "GT"
+
+
hunk ./lib/base/Jhc/Tuples.hs 37
-instance  (Show a, Show b) => Show (a,b)  where
-    showsPrec _ (x,y) s = (showChar '(' . shows x . showChar ',' .
-                                          shows y . showChar ')')
-			  s
hunk ./lib/base/Jhc/Tuples.hs 38
-instance (Show a, Show b, Show c) => Show (a, b, c) where
-    showsPrec _ (x,y,z) s = (showChar '(' . shows x . showChar ',' .
-					    shows y . showChar ',' .
-					    shows z . showChar ')')
-			    s
hunk ./lib/base/Prelude.hs 29
+    module Jhc.Show,
+    Num(..),
+    fromIntegral,
+    realToFrac,
+    Real(..),
+    Integral(..),
+    Fractional(..),
hunk ./lib/base/Prelude.hs 60
+import Jhc.Num
+import Jhc.Show
hunk ./lib/base/Prelude.hs 66
-infixl 7  *  , /, `quot`, `rem`, `div`, `mod`
-infixl 6  +, -
+--infixl 7  *  , /, `quot`, `rem`, `div`, `mod`
+--infixl 6  +, -
hunk ./lib/base/Prelude.hs 78
-
-
-
-
--- Numeric classes
-
-
-class  (Eq a, Show a) => Num a  where
-    (+), (-), (*)    :: a -> a -> a
-    negate           :: a -> a
-    abs, signum      :: a -> a
-    fromInteger      :: Integer -> a
-    fromInt          :: Int -> a
---    fromIntMax       :: IntMax -> a
---    fromWordMax      :: WordMax -> a
-
-        -- Minimal complete definition:
-        --      All, except negate or (-)
-    x - y            =  x + negate y
-    negate x         =  0 - x
-    fromInt i = fromInteger (toInteger i)
-    fromInteger x = fromInt (toInt x)
-
-
-class  (Num a, Ord a) => Real a  where
-    toRational       ::  a -> Rational
-
-
-class  (Real a, Enum a) => Integral a  where
-    quot, rem        :: a -> a -> a
-    div, mod         :: a -> a -> a
-    quotRem, divMod  :: a -> a -> (a,a)
-    toInteger        :: a -> Integer
-    toInt            :: a -> Int
---    toIntMax         :: a -> IntMax
---    toWordMax        :: a -> WordMax
-
-        -- Minimal complete definition:
-        --      quotRem, toInteger
-    n `quot` d       =  q  where (q,r) = quotRem n d
-    n `rem` d        =  r  where (q,r) = quotRem n d
-    n `div` d        =  q  where (q,r) = divMod n d
-    n `mod` d        =  r  where (q,r) = divMod n d
-    divMod n d       =  if signum r == - signum d then (q-1, r+d) else qr
-                        where qr@(q,r) = quotRem n d
-    quotRem n d       =  (n `quot` d, n `rem` d)
-    --toInteger x = Integer (toInt x)
-    --toInt x = case toInteger x of
-    --    Integer y -> y
-    toInteger x = toInteger (toInt x)
-    toInt x = toInt (toInteger x)
-    --toIntMax x = toIntMax (toInteger x)
-    --toWordMax x = toWordMax (toInteger x)
-
-
-class  (Num a) => Fractional a  where
-    (/)              :: a -> a -> a
-    recip            :: a -> a
-    fromRational     :: Rational -> a
-
-        -- Minimal complete definition:
-        --      fromRational and (recip or (/))
-    recip x          =  1 / x
-    x / y            =  x * recip y
-
hunk ./lib/base/Prelude.hs 225
-fromIntegral     :: (Integral a, Num b) => a -> b
-fromIntegral     =  fromInteger . toInteger
-
-{-# RULES
-  "fromIntegral/Int"          fromIntegral = (id :: Int -> Int)
-  "fromIntegral/Integer"      fromIntegral = (id :: Integer -> Integer)
-  "fromIntegral/toInt"        fromIntegral = toInt
-  "fromIntegral/fromInt"      fromIntegral = fromInt
-  "fromIntegral/toInteger"    fromIntegral = toInteger
-  "fromIntegral/fromInteger"  fromIntegral = fromInteger
- #-}
-
-
-realToFrac     :: (Real a, Fractional b) => a -> b
-realToFrac      =  fromRational . toRational
hunk ./lib/base/Prelude/Text.hs 12
+import Jhc.Show
hunk ./lib/base/Prelude/Text.hs 22
-type  ShowS    = String -> String
hunk ./lib/base/Prelude/Text.hs 39
-class  Show a  where
-    showsPrec        :: Int -> a -> ShowS
-    show             :: a -> String
-    showList         :: [a] -> ShowS
-
-        -- Mimimal complete definition:
-        --      show or showsPrec
-    showsPrec _ x s   = show x ++ s
-
-    show x            = showsPrec 0 x ""
-
-    showList []       = showString "[]"
-    showList (x:xs)   = showChar '[' . shows x . showl xs
-                        where showl []     = showChar ']'
-                              showl (x:xs) = showChar ',' . shows x .
-                                             showl xs
hunk ./lib/base/Prelude/Text.hs 43
-shows            :: (Show a) => a -> ShowS
-shows            =  showsPrec 0
-
hunk ./lib/base/Prelude/Text.hs 49
-{-# INLINE showChar, showString #-}
-showChar         :: Char -> ShowS
-showChar         =  (:)
-
-showString       :: String -> ShowS
-showString       =  (++)
-
-showParen        :: Bool -> ShowS -> ShowS
-showParen b p    =  if b then showChar '(' . p . showChar ')' else p
-
hunk ./lib/base/Prelude/Text.hs 132
-instance  Show ()  where
-    showsPrec p () = showString "()"
-
hunk ./lib/base/Prelude/Text.hs 157
-instance  (Show a) => Show [a]  where
-    showsPrec p      = showList
hunk ./lib/base/Prelude/Text.hs 169
-instance Show Bool where
-    showsPrec d (False) = showString "False"
-    showsPrec d (True) = showString "True"
hunk ./lib/base/Prelude/Text.hs 178
-instance Show Ordering where
-    showsPrec d (LT) = showString "LT"
-    showsPrec d (EQ) = showString "EQ"
-    showsPrec d (GT) = showString "GT"
-
hunk ./utils/op_process.prl 129
-    my $c_num = hsname("Prelude.Num");
+    my $c_num = hsname("Jhc.Num.Num");
hunk ./utils/op_process.prl 142
-        push @cmeth, "($c_num, toInstName \"Prelude.fromInt.$d->[0]\", ELam $ivar (EVar $ivar))";
-        push @cmeth, "($c_num, toInstName \"Prelude.toInt.$d->[0]\", ELam $ivar (EVar $ivar))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.fromInt.$d->[0]\", ELam $ivar (EVar $ivar))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.toInt.$d->[0]\", ELam $ivar (EVar $ivar))";
hunk ./utils/op_process.prl 145
-        push @cmeth, "($c_num, toInstName \"Prelude.fromInt.$d->[0]\", ELam $ivar (create_integralCast_fromInt $cncons $rtype (EVar $ivar) $t))";
-        push @cmeth, "($c_num, toInstName \"Prelude.toInt.$d->[0]\", ELam $tvar (create_integralCast_toInt $cncons $rtype (EVar $tvar)))" if $d->[2] =~ /int/ ;
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.fromInt.$d->[0]\", ELam $ivar (create_integralCast_fromInt $cncons $rtype (EVar $ivar) $t))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.toInt.$d->[0]\", ELam $tvar (create_integralCast_toInt $cncons $rtype (EVar $tvar)))" if $d->[2] =~ /int/ ;
hunk ./utils/op_process.prl 149
-        push @cmeth, "($c_num, toInstName \"Prelude.fromInteger.$d->[0]\", ELam $ivart (EVar $ivart))";
-        push @cmeth, "($c_num, toInstName \"Prelude.toInteger.$d->[0]\", ELam $ivart (EVar $ivart))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.fromInteger.$d->[0]\", ELam $ivart (EVar $ivart))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.toInteger.$d->[0]\", ELam $ivart (EVar $ivart))";
hunk ./utils/op_process.prl 152
-        push @cmeth, "($c_num, toInstName \"Prelude.fromInteger.$d->[0]\", ELam $ivart (create_integralCast_fromInteger $cncons $rtype (EVar $ivart) $t))";
-        push @cmeth, "($c_num, toInstName \"Prelude.toInteger.$d->[0]\", ELam $tvar (create_integralCast_toInteger $cncons $rtype (EVar $tvar)))" if $d->[2] =~ /int/ ;
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.fromInteger.$d->[0]\", ELam $ivart (create_integralCast_fromInteger $cncons $rtype (EVar $ivart) $t))";
+        push @cmeth, "($c_num, toInstName \"Jhc.Num.toInteger.$d->[0]\", ELam $tvar (create_integralCast_toInteger $cncons $rtype (EVar $tvar)))" if $d->[2] =~ /int/ ;
hunk ./utils/op_process.prl 156
-    push @cmeth, "($c_num, toInstName \"Prelude.abs.$d->[0]\", ELam $tvar (build_abs \"$d->[1]\" $cncons (EVar $tvar)  ))" if $d->[2] =~ /int/ ;
+    push @cmeth, "($c_num, toInstName \"Jhc.Num.abs.$d->[0]\", ELam $tvar (build_abs \"$d->[1]\" $cncons (EVar $tvar)  ))" if $d->[2] =~ /int/ ;
hunk ./utils/op_process.prl 158
-    push @cmeth, "($c_num, toInstName \"Prelude.signum.$d->[0]\", ELam $tvar (build_signum \"$d->[1]\" $cncons (EVar $tvar) ))" if $d->[2] =~ /int/ ;
+    push @cmeth, "($c_num, toInstName \"Jhc.Num.signum.$d->[0]\", ELam $tvar (build_signum \"$d->[1]\" $cncons (EVar $tvar) ))" if $d->[2] =~ /int/ ;