[rearrange a lot of the library to break more cyclic dependencies
John Meacham <john@repetae.net>**20080213072101] addfile ./lib/base/Jhc/Maybe.hs
hunk ./lib/base/Foreign/C/String.hs 1
-{-# OPTIONS_JHC -fffi #-}
+{-# OPTIONS_JHC -N -fffi #-}
hunk ./lib/base/Foreign/C/String.hs 91
+import Jhc.Basics
+import Jhc.Monad
+import Jhc.Order
+import Jhc.List
+import Jhc.Num
hunk ./lib/base/Foreign/C/String.hs 101
-import Data.Char ( chr, ord )
hunk ./lib/base/Foreign/Marshal/Alloc.hs 1
-{-# OPTIONS_JHC -fffi #-}
+{-# OPTIONS_JHC -N -fffi #-}
hunk ./lib/base/Foreign/Marshal/Alloc.hs 26
+import Jhc.Basics
+import Jhc.Monad
+import Jhc.Order
hunk ./lib/base/Foreign/Marshal/Alloc.hs 32
+import Jhc.Num
hunk ./lib/base/Foreign/Marshal/Array.hs 1
+{-# OPTIONS_JHC -N  #-}
hunk ./lib/base/Foreign/Marshal/Array.hs 51
-import Foreign.Ptr
-import Foreign.Storable
hunk ./lib/base/Foreign/Marshal/Array.hs 52
-import Prelude.IOError
hunk ./lib/base/Foreign/Marshal/Array.hs 53
+import Foreign.Ptr
+import Foreign.Storable
+import Jhc.Basics
hunk ./lib/base/Foreign/Marshal/Array.hs 57
+import Jhc.List
+import Jhc.Monad
+import Jhc.Num
+import Jhc.Order
+import Prelude.IOError
hunk ./lib/base/Foreign/Marshal/Utils.hs 1
-{-# OPTIONS_JHC -fffi #-}
+{-# OPTIONS_JHC -N -fffi #-}
hunk ./lib/base/Foreign/Marshal/Utils.hs 54
+import Jhc.Basics
+import Jhc.IO
+import Jhc.List
+import Jhc.Monad
+import Jhc.Num
+import Jhc.Order
+import Jhc.Maybe
hunk ./lib/base/Foreign/Ptr.hs 1
-{-# OPTIONS_JHC -fffi #-}
+{-# OPTIONS_JHC -N -fffi #-}
hunk ./lib/base/Foreign/Ptr.hs 18
+import Jhc.Show
+import Jhc.Inst.Show
+import Jhc.Monad
+import Jhc.Order
+import Jhc.IO
+import Jhc.Basics
+import Jhc.Num
hunk ./lib/base/Jhc/Inst/Show.hs 5
-import Jhc.Show
-import Prelude.Text
hunk ./lib/base/Jhc/Inst/Show.hs 6
-import Jhc.Basics
hunk ./lib/base/Jhc/Inst/Show.hs 7
-import Jhc.Order
+import Jhc.Basics
hunk ./lib/base/Jhc/Inst/Show.hs 9
-import Numeric(showInt)
+import Jhc.Order
+import Jhc.Show
hunk ./lib/base/Jhc/Inst/Show.hs 15
-    showsPrec _ x = showInt x
+    showsPrec _ x = showWord x
hunk ./lib/base/Jhc/Inst/Show.hs 18
-    showsPrec _ x = showInt (fromIntegral x :: Word)
+    showsPrec _ x = showWord (fromIntegral x :: Word)
hunk ./lib/base/Jhc/Inst/Show.hs 21
-    showsPrec _ x = showInt (fromIntegral x :: Word)
+    showsPrec _ x = showWord (fromIntegral x :: Word)
hunk ./lib/base/Jhc/Inst/Show.hs 24
-    showsPrec _ x = showInt (fromIntegral x :: Word)
+    showsPrec _ x = showWord (fromIntegral x :: Word)
hunk ./lib/base/Jhc/Inst/Show.hs 27
-    showsPrec _ x = showInt (fromIntegral x :: WordMax)
+    showsPrec _ x = showWordMax (fromIntegral x :: WordMax)
hunk ./lib/base/Jhc/Inst/Show.hs 30
-    showsPrec _ x = showInt (fromIntegral x :: WordMax)
+    showsPrec _ x = showWordMax (fromIntegral x :: WordMax)
hunk ./lib/base/Jhc/Inst/Show.hs 33
-    showsPrec _ x = showInt x
+    showsPrec _ x = showWordMax x
hunk ./lib/base/Jhc/Inst/Show.hs 37
-        | x < 0 = showParen (p > 6) (showChar '-' . showInt (fromIntegral $ negate x :: Word))
-        | otherwise = showInt (fromIntegral x :: Word)
+        | x < 0 = showParen (p > 6) (showChar '-' . showWord (fromIntegral $ negate x :: Word))
+        | otherwise = showWord (fromIntegral x :: Word)
hunk ./lib/base/Jhc/Inst/Show.hs 42
-        | x < 0 = showParen (p > 6) (showChar '-' . showInt (fromIntegral $ negate x :: WordMax))
-        | otherwise = showInt (fromIntegral x :: WordMax)
+        | x < 0 = showParen (p > 6) (showChar '-' . showWordMax (fromIntegral $ negate x :: WordMax))
+        | otherwise = showWordMax (fromIntegral x :: WordMax)
hunk ./lib/base/Jhc/Inst/Show.hs 57
+-- specialized base 10 only versions of show
+showWord :: Word -> String -> String
+showWord w rest = case quotRem w 10 of
+    (n',d) -> if n' == 0 then rest' else showWord n' rest'
+        where rest' = chr (fromIntegral n' + ord '1') : rest
+
+showWordMax :: WordMax -> String -> String
+showWordMax w rest = case quotRem w 10 of
+    (n',d) -> if n' == 0 then rest' else showWordMax n' rest'
+        where rest' = chr (fromIntegral n' + ord '1') : rest
+
hunk ./lib/base/Jhc/List.hs 104
+
+null             :: [a] -> Bool
+null []          =  True
+null (_:_)       =  False
+
+-- length returns the length of a finite list as an Int.
+
+length           :: [a] -> Int
+length xs = f xs zero where
+    f [] n = n
+    f (_:xs) n = f xs $! n `plus` one
hunk ./lib/base/Jhc/Maybe.hs 1
+{-# OPTIONS_JHC -N -fffi #-}
+module Jhc.Maybe where
+
+import Jhc.Monad
+import Jhc.Order
+import Jhc.Show
+import Jhc.List
+import Jhc.Basics
+import Jhc.Num
+
+instance Monad Maybe where
+    return x = Just x
+    Nothing >>= _ = Nothing
+    Just x >>= y = y x
+    fail _ = Nothing
+
+
+
+instance Functor Maybe where
+    fmap _ Nothing = Nothing
+    fmap f (Just x) = Just (f x)
+
+
+
+-- Maybe
+-- need to add Read instance
+
+data Maybe a  =  Nothing | Just a
+    deriving (Eq, Ord, Show)
+
+maybe :: b -> (a -> b) -> Maybe a -> b
+maybe n f m = case m of
+    Just x -> f x
+    Nothing -> n
+
+
hunk ./lib/base/Prelude/IO.hs 1
-{-# OPTIONS_JHC -fffi -funboxed-values #-}
+{-# OPTIONS_JHC -N -fffi -funboxed-values #-}
hunk ./lib/base/Prelude/IO.hs 17
-    readIO,
-    readLn,
hunk ./lib/base/Prelude/IO.hs 23
-import Prelude
-import Prelude.Text
-import Prelude.IOError
-import Jhc.Addr
-import Jhc.IO
-import Data.Char
-import Foreign.C.Types
hunk ./lib/base/Prelude/IO.hs 24
+import Foreign.C.Types
hunk ./lib/base/Prelude/IO.hs 26
+import Jhc.Addr
+import Jhc.Basics
+import Jhc.IO
+import Jhc.Monad
+import Jhc.Order
+import Jhc.Show
+import Prelude.IOError
hunk ./lib/base/Prelude/IO.hs 110
-  -- raises an exception instead of an error
-readIO   :: Read a => String -> IO a
-readIO s =  case [x | (x,t) <- reads s, ("","") <- lex t] of
-              [x] -> return x
-              []  -> ioError (userError "Prelude.readIO: no parse")
-              _   -> ioError (userError "Prelude.readIO: ambiguous parse")
hunk ./lib/base/Prelude/IO.hs 111
-readLn :: Read a => IO a
-readLn =  do l <- getLine
-             r <- readIO l
-             return r
hunk ./lib/base/Prelude/IOError.hs 1
+{-# OPTIONS_JHC -N #-}
hunk ./lib/base/Prelude/IOError.hs 5
+import Jhc.Show
hunk ./lib/base/Prelude/IOError.hs 12
-
hunk ./lib/base/Prelude/Text.hs 6
-    showChar, showString, readParen, showParen ) where
+    showChar, showString, readParen, showParen,readIO,readLn ) where
hunk ./lib/base/Prelude/Text.hs 13
+import Jhc.Inst.Show()
hunk ./lib/base/Prelude/Text.hs 23
+readLn :: Read a => IO a
+readLn =  do l <- getLine
+             r <- readIO l
+             return r
+
+  -- raises an exception instead of an error
+readIO   :: Read a => String -> IO a
+readIO s =  case [x | (x,t) <- reads s, ("","") <- lex t] of
+              [x] -> return x
+              []  -> ioError (userError "Prelude.readIO: no parse")
+              _   -> ioError (userError "Prelude.readIO: ambiguous parse")
+
hunk ./lib/base/Prelude.hs 24
+    length,
+    null,
hunk ./lib/base/Prelude.hs 27
+    Maybe(Just,Nothing),
+    maybe,
hunk ./lib/base/Prelude.hs 70
+import Jhc.Maybe
hunk ./lib/base/Prelude.hs 139
-instance Monad Maybe where
-    return x = Just x
-    Nothing >>= _ = Nothing
-    Just x >>= y = y x
-    fail _ = Nothing
hunk ./lib/base/Prelude.hs 142
-instance Functor Maybe where
-    fmap _ Nothing = Nothing
-    fmap f (Just x) = Just (f x)
-
-
-
--- Maybe
-
-data Maybe a  =  Nothing | Just a
-    deriving (Eq, Ord, Read, Show)
-
-
-maybe :: b -> (a -> b) -> Maybe a -> b
-maybe n f m = case m of
-    Just x -> f x
-    Nothing -> n
-
hunk ./lib/base/Prelude.hs 185
-null             :: [a] -> Bool
-null []          =  True
-null (_:_)       =  False
-
--- length returns the length of a finite list as an Int.
-
-length           :: [a] -> Int
-length xs = f xs 0 where
-    f [] n = n
-    f (_:xs) n = f xs $! n + 1
-