[move list to jhc-prim, switch Char to use Char_ newtype
John Meacham <john@repetae.net>**20120123090930
 Ignore-this: a5c6e7bd8c0131618c57ff090cce33eb
] hunk ./Makefile.am 218
-LIB_OPTIONS=$(RTSOPTS) $(JHC_TEST) --noauto -L- -L. # --deps tmp/$@.yaml
+LIB_OPTIONS=$(RTSOPTS) $(JHC_TEST) -flint -L- -L.
hunk ./lib/jhc-prim/Jhc/Prim/Bits.hs 38
-newtype Addr_ = Addr_ BitsPtr_
+newtype Addr_    = Addr_ BitsPtr_
hunk ./lib/jhc-prim/Jhc/Prim/Bits.hs 40
-newtype Char_ = Char_ Bits32_
-newtype Bool_ = Bool_ Bits16_
+newtype Bool_    = Bool_ Bits16_
+newtype Char_    = Char_ Bits32_
hunk ./lib/jhc-prim/Jhc/Prim/Prim.hs 12
+infixr 5  :
+data [] a =  a : ([] a) | []
hunk ./lib/jhc/Jhc/Basics.hs 2
-module Jhc.Basics(module Jhc.Basics, module Jhc.Prim) where
+module Jhc.Basics(module Jhc.Basics, module Jhc.Prim, module Jhc.Prim.Prim) where
hunk ./lib/jhc/Jhc/Basics.hs 6
+import Jhc.Prim.Prim
hunk ./lib/jhc/Jhc/Basics.hs 129
-ord (Char c) = boxInt c
+ord (Char (Char_ c)) = boxInt c
hunk ./lib/jhc/Jhc/Basics.hs 132
-chr i = Char (unboxInt i)
+chr i = Char (Char_ (unboxInt i))
hunk ./lib/jhc/Jhc/Enum.hs 115
-foreign import primitive "UGt"       bits32UGt       :: Bits32_ -> Bits32_ -> Bool__
-foreign import primitive "UGte"      bits32UGte      :: Bits32_ -> Bits32_ -> Bool__
-foreign import primitive "increment" bits32Increment :: Bits32_ -> Bits32_
+--foreign import primitive "UGt"       bits32UGt       :: Bits32_ -> Bits32_ -> Bool__
+--foreign import primitive "UGte"      bits32UGte      :: Bits32_ -> Bits32_ -> Bool__
+--foreign import primitive "increment" bits32Increment :: Bits32_ -> Bits32_
hunk ./lib/jhc/Jhc/Enum.hs 119
-foreign import primitive "Add"       bits32Add       :: Bits32_ -> Bits32_ -> Bits32_
-foreign import primitive "Sub"       bits32Sub       :: Bits32_ -> Bits32_ -> Bits32_
+--foreign import primitive "Add"       bits32Add       :: Bits32_ -> Bits32_ -> Bits32_
+--foreign import primitive "Sub"       bits32Sub       :: Bits32_ -> Bits32_ -> Bits32_
hunk ./lib/jhc/Jhc/Order.hs 92
-INST_EQORDER(Char,Char,Bits32_,U)
+INST_EQORDER(Char,Char,Char_,U)
hunk ./lib/jhc/Jhc/Prim.hs 2
-module Jhc.Prim(module Jhc.Prim.Bits, module Jhc.Prim, module Jhc.Prim.IO) where
+module Jhc.Prim(module Jhc.Prim.Bits, module Jhc.Prim, module Jhc.Prim.Prim, module Jhc.Prim.IO) where
hunk ./lib/jhc/Jhc/Prim.hs 8
-infixr 5  :
-data [] a =  a : ([] a) | []
-
---newtype IO a = IO (World__ -> (# World__, a #))
-
---data World__ :: #
-
hunk ./lib/jhc/Jhc/Prim.hs 9
-data Char = Char Char__
+data Char = Char Char_
hunk ./lib/jhc/Jhc/Prim.hs 23
-
hunk ./lib/jhc/Jhc/String.hs 12
-
hunk ./lib/jhc/Jhc/String.hs 13
-
--- TODO make it handle full UTF8
+import Jhc.Prim.Prim
+import Jhc.Prim.Bits
hunk ./lib/jhc/Jhc/String.hs 21
-        0# -> []
+        Char_ 0# -> []
hunk ./lib/jhc/Jhc/String.hs 24
+unpackStringFoldr :: Addr__ -> (Char -> b -> b) -> b -> b
+unpackStringFoldr addr cons nil = f addr where
+    f addr = case constPeekByte addr of
+        Char_ 0# -> nil
+        c -> (Char c `cons` f (increment addr))
+
+{-# NOINLINE eqUnpackedString #-}
+eqUnpackedString :: Addr__ -> [Char] -> Bool_
+eqUnpackedString addr cs = f addr cs where
+    f :: Addr__ -> [Char] -> Bool_
+    f offset [] = case constPeekByte offset of Char_ 0# -> Bool_ 1#; _ -> Bool_ 0#
+    f offset (Char c:cs) = case constPeekByte offset of
+        Char_ 0# -> Bool_ 0#
+        uc -> case equalsChar uc c of
+            Bool_ 0# -> Bool_ 0#
+            Bool_ 1# -> f (increment offset) cs
+
+eqSingleChar :: Char_ -> [Char] -> Bool_
+eqSingleChar ch (Char c:cs) = case equalsChar ch c of
+    Bool_ 0# -> Bool_ 0#
+    Bool_ 1# -> case cs of
+        [] -> Bool_ 1#
+        _ -> Bool_ 0#
+
+{-# NOINLINE eqUnpacked #-}
+eqUnpacked :: Addr__ -> [Char] -> Bool_
+eqUnpacked addr cs = f addr cs where
+    f :: Addr__ -> [Char] -> Bool_
+    f offset [] = case constPeekByte offset of Char_ 0# -> Bool_ 1#; Char_ _ -> Bool_ 0#
+    f offset (Char c:cs) = case constPeekByte offset of
+        Char_ 0# -> Bool_ 0#
+        uc -> case equalsChar uc c of
+            Bool_ 0# -> Bool_ 0#
+            Bool_ 1# -> f (increment offset) cs
+
+eqString :: [Char] -> [Char] -> Bool_
+eqString [] [] = Bool_ 1#
+eqString (Char x:xs) (Char y:ys) = case equalsChar x y of
+    Bool_ 0# -> Bool_ 0#
+    Bool_ 1# -> eqString xs ys
+eqString _ _ = Bool_ 0#
+
+foreign import primitive increment :: Addr__ -> Addr__
+foreign import primitive "Eq" equalsChar :: Char_ -> Char_ -> Bool_
+foreign import primitive constPeekByte :: Addr__ -> Char_
+
hunk ./lib/jhc/Jhc/String.hs 71
-unpackFoldrString :: Addr__ -> (Char__ -> b -> b) -> b -> b
+unpackFoldrString :: Addr__ -> (Char_ -> b -> b) -> b -> b
hunk ./lib/jhc/Jhc/String.hs 75
-      ch  | ch `leChar__` '\x7F'# = ch `f` unpack (increment addr)
-          | ch `leChar__` '\xDF'# = (((ch .&. '\x1f') `shiftL` 6#) .|. (constPeekByte (increment addr) .&. '\x3f')) `f` unpack (increment (increment addr))
+      ch  | ch `leChar_` '\x7F'# = ch `f` unpack (increment addr)
+          | ch `leChar_` '\xDF'# = (((ch .&. '\x1f') `shiftL` 6#) .|. (constPeekByte (increment addr) .&. '\x3f')) `f` unpack (increment (increment addr))
hunk ./lib/jhc/Jhc/String.hs 95
-
-unpackStringFoldr :: Addr__ -> (Char -> b -> b) -> b -> b
-unpackStringFoldr addr cons nil = f addr where
-    f addr = case constPeekByte addr of
-        0# -> nil
-        c -> (Char c `cons` f (increment addr))
-
-{-# NOINLINE eqUnpackedString #-}
-eqUnpackedString :: Addr__ -> [Char] -> Bool__
-eqUnpackedString addr cs = f addr cs where
-    f :: Addr__ -> [Char] -> Bool__
-    f offset [] = case constPeekByte offset of 0# -> 1#; _ -> 0#
-    f offset (Char c:cs) = case constPeekByte offset of
-        0# -> 0#
-        uc -> case equalsChar uc c of
-            0# -> 0#
-            1# -> f (increment offset) cs
-
-eqSingleChar :: Char__ -> [Char] -> Bool__
-eqSingleChar ch (Char c:cs) = case equalsChar ch c of
-    0# -> 0#
-    1# -> case cs of
-        [] -> 1#
-        _ -> 0#
-
-
-{-# NOINLINE eqUnpacked #-}
-eqUnpacked :: Addr__ -> [Char] -> Bool__
-eqUnpacked addr cs = f addr cs where
-    f :: Addr__ -> [Char] -> Bool__
-    f offset [] = case constPeekByte offset of 0# -> 1#; _ -> 0#
-    f offset (Char c:cs) = case constPeekByte offset of
-        0# -> 0#
-        uc -> case equalsChar uc c of
-            0# -> 0#
-            1# -> f (increment offset) cs
-
-
-
-eqString :: [Char] -> [Char] -> Bool__
-eqString [] [] = 1#
-eqString (Char x:xs) (Char y:ys) = case equalsChar x y of
-    0# -> 0#
-    1# -> eqString xs ys
-eqString _ _ = 0#
-
-foreign import primitive increment :: Addr__ -> Addr__
-foreign import primitive "Eq" equalsChar :: Char__ -> Char__ -> Bool__
--- returns it in an Char__ even though it is just a byte
-foreign import primitive constPeekByte :: Addr__ -> Char__
hunk ./src/E/PrimOpt.hs 8
-import Maybe
+import Data.Maybe
+import Text.Printf
hunk ./src/E/PrimOpt.hs 12
-import Cmm.Op(stringToOpTy)
+import Cmm.Op(readTy,Ty)
hunk ./src/E/PrimOpt.hs 150
+stringToOpTy :: String -> Ty
+stringToOpTy s = case readTy s of
+    Just t -> t
+    _ -> error $ printf "stringToOpTy(%s)" s
+
+stringToOpTy' :: String -> String -> Ty
+stringToOpTy' x s = case readTy s of
+    Just t -> t
+    _ -> error $ printf "stringToOpTy(%s): '%s'" x s
+
+stot :: Show a => a -> Int -> String -> Ty
+stot op n s = stringToOpTy' (show op ++ show n) s
+
hunk ./src/E/PrimOpt.hs 172
-                (EPrim (APrim Op { primCOp = Op.BinOp cop (stringToOpTy ta) (stringToOpTy tb), primRetTy = (stringToOpTy tr) } mempty) [pa, pb] str) t
+                (EPrim (APrim Op { primCOp = Op.BinOp cop (stot cop 1 ta) (stot cop 2 tb), primRetTy = (stot cop 0 tr) } mempty) [pa, pb] str) t
hunk ./src/data/names.txt 6
-List       Jhc.Prim.[]
+List       Jhc.Prim.Prim.[]
hunk ./src/data/names.txt 75
-Cons       Jhc.Prim.:
-EmptyList  Jhc.Prim.[]
+Cons       Jhc.Prim.Prim.:
+EmptyList  Jhc.Prim.Prim.[]
hunk ./src/data/names.txt 80
-#Int        Int#
-#Integer    Integer#