[major code cleanups. moved stuff to Util/ got rid of a lot of hardcoded names and moved them all to Name.Names. 
John Meacham <john@repetae.net>**20051023130700] move ./ArbitraryInstances.hs ./Util/ArbitraryInstances.hs
move ./MonadUtil.hs ./Util/ContextMonad.hs
move ./MonoidUtil.hs ./Util/Inst.hs
adddir ./Name
move ./Name.hs ./Name/Name.hs
move ./NameMonad.hs ./Util/NameMonad.hs
move ./UniqueMonad.hs ./Util/UniqueMonad.hs
move ./VConsts.hs ./Name/VConsts.hs
addfile ./Name/Names.hs
addfile ./Util/Gen.hs
addfile ./Util/README
hunk ./C/FromGrin.hs 27
-import VConsts
+import Name.VConsts
hunk ./DataConstructors.hs 21
-import qualified Data.IntMap as IM
hunk ./DataConstructors.hs 32
-import Name
+import Name.Name as Name
+import Name.Names
hunk ./DataConstructors.hs 39
-import VConsts
+import Name.VConsts
hunk ./E/Arbitrary.hs 16
-import VConsts
+import Name.VConsts
hunk ./E/CPR.hs 15
-import Name
+import Name.Name
+import Name.Names
hunk ./E/E.hs 12
-import VConsts
-import Name
+import Name.VConsts
+import Name.Name
+import Name.Names
hunk ./E/E.hs 340
-dc_Addr = toName DataConstructor ("Jhc.Addr","Addr")
-dc_Char = toName DataConstructor ("Prelude","Char")
-dc_EmptyList = toName DataConstructor ("Prelude","[]")
-dc_Integer = toName DataConstructor ("Prelude","Integer")
-dc_Int = toName DataConstructor ("Prelude","Int")
-dc_JustIO = toName DataConstructor ("Jhc.IO", "JustIO")
-dc_Rational = toName DataConstructor ("Ratio",":%")
-dc_World__ = toName DataConstructor ("Jhc.IO","World__")
-tc_World__ = toName TypeConstructor ("Jhc.IO","World__")
-tc_Absurd = toName TypeConstructor ("Jhc@","Absurd#")
-tc_Arrow = toName TypeConstructor ("Jhc@","->")
-tc_IOResult = toName TypeConstructor ("Jhc.IO","IOResult")
-tc_IO = toName TypeConstructor ("Jhc.IO", "IO")
-tc_List = toName TypeConstructor ("Prelude","[]")
-tc_Ptr = toName TypeConstructor ("Foreign.Ptr","Ptr")
+
hunk ./E/E.hs 343
-
hunk ./E/FromHs.hs 32
-import Name
-import NameMonad
+import Name.Name as Name
+import Name.Names
+import Util.NameMonad
hunk ./E/FromHs.hs 40
-import VConsts
+import Name.VConsts
hunk ./E/FromHs.hs 43
-theMainName = toName Name.Val (UnQual $ HsIdent "theMain")
+theMainName = toName Name.Val "theMain"
hunk ./E/FromHs.hs 86
-    pl [] = HsPApp (Qual prelude_mod (HsIdent "[]")) []
-    pl (p:xs) = HsPApp (Qual prelude_mod (HsIdent ":")) [simplifyHsPat p, pl xs]
+    pl [] = HsPApp (nameName $ dc_EmptyList) []
+    pl (p:xs) = HsPApp (nameName $ dc_Cons) [simplifyHsPat p, pl xs]
hunk ./E/FromHs.hs 107
-Identity nameFuncNames = fmapM (return . toName Val) sFuncNames
hunk ./E/FromHs.hs 129
-        runMain <- findName (func_runMain nameFuncNames)
-        runExpr <- findName (func_runExpr nameFuncNames)
+        runMain <- findName (func_runMain sFuncNames)
+        runExpr <- findName (func_runExpr sFuncNames)
hunk ./E/FromHs.hs 238
-    Identity funcs = fmapM (return . EVar . toTVr assumps) nameFuncNames
+    Identity funcs = fmapM (return . EVar . toTVr assumps) sFuncNames
hunk ./E/LambdaLift.hs 20
-import Name
+import Name.Name
hunk ./E/LambdaLift.hs 22
-import UniqueMonad
+import Util.UniqueMonad
hunk ./E/Pretty.hs 15
-import Name
+import Name.Name
+import Name.Names
hunk ./E/Pretty.hs 21
-import VConsts
+import Name.VConsts
hunk ./E/PrimOpt.hs 18
-import NameMonad
+import Util.NameMonad
hunk ./E/Rules.hs 24
-import qualified Data.IntMap as IM
hunk ./E/Rules.hs 37
-import Name
+import Name.Name
+import Name.Names
hunk ./E/Rules.hs 179
-preludeError = nameValue "Prelude" "error"
+preludeError = toId v_error
hunk ./E/SSimplify.hs 28
-import Name
-import NameMonad
+import Name.Name
+import Util.NameMonad
hunk ./E/SSimplify.hs 37
-import VConsts
+import Name.VConsts
hunk ./E/Strictness.hs 11
-import Boolean.Algebra
hunk ./E/Strictness.hs 12
+import Boolean.Algebra
hunk ./E/Strictness.hs 20
-import MonoidUtil()
+import Util.Inst()
hunk ./E/Traverse.hs 21
-import Name
-import NameMonad
+import Name.Name
+import Util.NameMonad
hunk ./E/TypeAnalysis.hs 21
-import Name
+import Name.Name
hunk ./E/TypeCheck.hs 13
-import MonadUtil
+import Util.ContextMonad
hunk ./E/Values.hs 19
-import Name
-import VConsts
+import Name.Name
+import Name.Names
+import Name.VConsts
hunk ./E/WorkerWrapper.hs 20
-import Name
+import Name.Name
hunk ./FrontEnd/Class.hs 54
-import Binary
hunk ./FrontEnd/Class.hs 58
+import List((\\), partition)
+import qualified Data.Map as Map
+import Text.PrettyPrint.HughesPJ as PPrint
+
+import Binary
hunk ./FrontEnd/Class.hs 64
-import GenUtil(concatInter)
-import GenUtil(snub)
-import Util.HasSize
+import GenUtil(snub,concatInter)
hunk ./FrontEnd/Class.hs 67
-import List((\\), partition)
hunk ./FrontEnd/Class.hs 70
-import MonoidUtil
-import Name
-import qualified Data.Map as Map
+import Name.Name
+import Name.Names
+import Name.VConsts
hunk ./FrontEnd/Class.hs 74
-import Text.PrettyPrint.HughesPJ as PPrint
hunk ./FrontEnd/Class.hs 76
+import Util.HasSize
+import Util.Inst()
hunk ./FrontEnd/Class.hs 79
-import VConsts
hunk ./FrontEnd/Class.hs 483
-        | n == classEnum = [cia  (hsValName ("Prelude","toEnum")), cia $ hsValName ("Prelude","fromEnum")]
-        | n == classBounded = [cia  (hsValName ("Prelude","minBound")), cia $ hsValName ("Prelude","maxBound")]
+        | n == classEnum = [cia  (nameName v_toEnum), cia $ nameName (v_fromEnum)]
+        | n == classBounded = [cia  (nameName v_minBound), cia $ nameName v_maxBound]
hunk ./FrontEnd/Class.hs 513
-getHsTypeCons (HsTyFun {}) = Qual (Module "Prelude") $ HsIdent "->"
-getHsTypeCons (HsTyTuple xs) = Qual (Module "Prelude") $ HsIdent ("(" ++ replicate (length xs - 1) ',' ++ ")")
+getHsTypeCons (HsTyFun {}) = nameName (tc_Arrow)
+getHsTypeCons (HsTyTuple xs) = nameName $ toTuple (length xs)
hunk ./FrontEnd/Class.hs 720
-defaults     = map (\name -> TCon (Tycon (Qual (Module "Prelude") (HsIdent name)) Star))
-                   ["Integer", "Double"]
+defaults     = map (\name -> TCon (Tycon (nameName name) Star))
+                   [tc_Integer, tc_Double]
hunk ./FrontEnd/Deriving.hs 5
-import VConsts
-import Name
+import Name.VConsts
+import Name.Name
+import Name.Names
hunk ./FrontEnd/Deriving.hs 10
-vars = [ UnQual (HsIdent ('d':show v ++ "_derive@") ) |  v <- [1::Int ..]]
hunk ./FrontEnd/Deriving.hs 13
+
+{-
+vars = [ UnQual (HsIdent ('d':show v ++ "_derive@") ) |  v <- [1::Int ..]]
hunk ./FrontEnd/Deriving.hs 18
-        | n == hsUnqualValName "Bounded" = [inst n (mkBounded cons)]
-        | n == hsUnqualValName "Enum" = [inst n (mkEnum cons)]
+        | show n == hs "Bounded" = [inst n (mkBounded cons)]
+        | show n ==  "Enum" = [inst n (mkEnum cons)]
hunk ./FrontEnd/Deriving.hs 25
-    mkBounded cs = [patBind (hsValName ("@Prelude","minBound")) (HsCon $ hsConDeclName (head cs)),  patBind (hsValName ("Prelude","maxBound")) (HsCon $ hsConDeclName (last cs))]
+    mkBounded cs = [patBind (nameName v_minBound) (HsCon $ hsConDeclName (head cs)),  patBind (nameName (v_maxBound)) (HsCon $ hsConDeclName (last cs))]
hunk ./FrontEnd/Deriving.hs 27
-        f (c,n) = match (hsValName ("@Prelude","fromEnum")) [HsPApp (hsConDeclName c) []] (HsLit $ HsInt ( n))
-        g (c,n) =  match (hsValName ("@Prelude","toEnum")) [HsPLit (HsInt ( n))] (HsCon (hsConDeclName c))
-        err = match (hsValName ("@Prelude","toEnum"))  [HsPWildCard] (HsApp (HsVar (hsValName ("@Prelude","error"))) (HsLit $ HsString $ "toEnum: " ++ show name))
+        f (c,n) = match (nameName v_fromEnum) [HsPApp (hsConDeclName c) []] (HsLit $ HsInt ( n))
+        g (c,n) =  match (nameName v_toEnum) [HsPLit (HsInt ( n))] (HsCon (hsConDeclName c))
+        err = match (nameName v_toEnum)  [HsPWildCard] (HsApp (HsVar (nameName v_error)) (HsLit $ HsString $ "toEnum: " ++ show name))
+        -}
hunk ./FrontEnd/Desugar.hs 42
-import VConsts
-import Name()
+import Name.VConsts
+import Name.Name
+import Name.Names
hunk ./FrontEnd/Desugar.hs 106
-newPatVarName = hsUnqualValName "patvar@0"
+newPatVarName = nameName $ toName Val "patvar@0"
hunk ./FrontEnd/Desugar.hs 110
-newVarName = hsUnqualValName "var@0"
+newVarName = nameName $ toName Val  "var@0"
hunk ./FrontEnd/Desugar.hs 213
-    let newRhsName = UnQual $ HsIdent $ "patrhs@" ++ show unique
+    let newRhsName = nameName $ toName Val ("patrhs@" ++ show unique)
hunk ./FrontEnd/Desugar.hs 265
-    var = UnQual (HsIdent "x")
-    err = UnQual (HsIdent "error")
+    var = nameName $ toName Val "x"
+    err = nameName $ toUnqualified $ v_error
hunk ./FrontEnd/Desugar.hs 431
-            a2 =  HsAlt sloc HsPWildCard (HsUnGuardedAlt (HsApp (HsVar (UnQual $ HsIdent "error")) (HsLit $ HsString $ show sloc ++ " failed pattern match in lambda"))) []
+            a2 =  HsAlt sloc HsPWildCard (HsUnGuardedAlt (HsApp (HsVar (nameName $ toUnqualified v_error)) (HsLit $ HsString $ show sloc ++ " failed pattern match in lambda"))) []
hunk ./FrontEnd/Desugar.hs 438
-        let n = UnQual $ HsIdent $ "lambind@" ++ show unique
+        let n = nameName $ toName Val ("lambind@" ++ show unique)
hunk ./FrontEnd/Desugar.hs 491
-        let nv = (hsUnqualValName "rsection@")
+        let nv = (nameName $ toName Val "rsection@")
hunk ./FrontEnd/Desugar.hs 641
+f_bind = nameName $ toUnqualified (func_bind sFuncNames)
+f_bind_ = nameName $ toUnqualified (func_bind_ sFuncNames)
+f_concatMap = nameName $ toUnqualified v_concatMap
+f_fail = nameName $ toUnqualified v_fail
+
hunk ./FrontEnd/Desugar.hs 653
-   = HsInfixApp (hsParen e) (HsVar (hsUnqualValName ">>")) (hsParen $ doToExp ss)
+   = HsInfixApp (hsParen e) (HsVar f_bind_) (hsParen $ doToExp ss)
hunk ./FrontEnd/Desugar.hs 655
-   = HsInfixApp (hsParen e) (HsVar (hsUnqualValName ">>=")) (HsLambda _srcLoc [pat] (doToExp ss))
-doToExp ((HsGenerator srcLoc pat e):ss) = HsInfixApp (hsParen e) (HsVar (hsUnqualValName ">>=")) (HsLambda srcLoc [HsPVar newPatVarName] kase)  where
+   = HsInfixApp (hsParen e) (HsVar f_bind) (HsLambda _srcLoc [pat] (doToExp ss))
+doToExp ((HsGenerator srcLoc pat e):ss) = HsInfixApp (hsParen e) (HsVar f_bind) (HsLambda srcLoc [HsPVar newPatVarName] kase)  where
hunk ./FrontEnd/Desugar.hs 659
-   a2 =  HsAlt srcLoc HsPWildCard (HsUnGuardedAlt (HsApp (HsVar (hsUnqualValName "fail")) (HsLit $ HsString $ show srcLoc ++ " failed pattern match in do"))) []
+   a2 =  HsAlt srcLoc HsPWildCard (HsUnGuardedAlt (HsApp (HsVar f_fail) (HsLit $ HsString $ show srcLoc ++ " failed pattern match in do"))) []
hunk ./FrontEnd/Desugar.hs 668
-    f ((HsGenerator srcLoc pat e):ss) = hsParen $ HsApp (HsApp (HsVar (hsUnqualValName "concatMap"))  (hsParen $ HsLambda srcLoc [HsPVar newPatVarName] kase)) e where
+    f ((HsGenerator srcLoc pat e):ss) = hsParen $ HsApp (HsApp (HsVar f_concatMap)  (hsParen $ HsLambda srcLoc [HsPVar newPatVarName] kase)) e where
hunk ./FrontEnd/Exports.hs 16
-import Name
+import Name.Name as Name
hunk ./FrontEnd/HsErrors.hs 10
-import VConsts
+import Name.VConsts
hunk ./FrontEnd/HsPretty.hs 33
-import VConsts
+import Name.VConsts
hunk ./FrontEnd/Infix.hs 26
-import Name
+import Name.Name
hunk ./FrontEnd/KindInfer.hs 26
-import MonadUtil
+import Util.ContextMonad
hunk ./FrontEnd/MultiModuleBasics.hs 25
-import Name
+import Name.Name
hunk ./FrontEnd/Rename.hs 69
+import Control.Monad.Identity
+import Data.FunctorM
hunk ./FrontEnd/Rename.hs 73
+import List
+import qualified Data.Map as Map
+
hunk ./FrontEnd/Rename.hs 81
-import List
-import MonadUtil
-import MonoidUtil
-import Name hiding(qualifyName)
-import qualified Data.Map as Map
+import Name.Name as Name hiding(qualifyName)
+import Name.Names
+import qualified Name.VConsts as V
+import Util.ContextMonad
+import Util.Gen
+import Util.Inst()
hunk ./FrontEnd/Rename.hs 88
-import VConsts hiding(func_fromInt, func_fromInteger, func_fromRational)
hunk ./FrontEnd/Rename.hs 162
-            | Just _ <- fromTupname hsName, Module "Prelude" <- mod
+            | Just _ <- V.fromTupname hsName, Module "Prelude" <- mod
hunk ./FrontEnd/Rename.hs 616
-func_fromInt = (HsVar (hsUnqualValName "fromInt"))
-func_fromInteger = (HsVar (hsUnqualValName "fromInteger"))
-func_fromRational = (HsVar (hsUnqualValName "fromRational"))
+
+uqFuncNames :: V.FuncNames HsName
+Identity uqFuncNames = fmapM (return . nameName . toUnqualified) sFuncNames
+
+func_fromInt = (HsVar $ V.func_fromInt uqFuncNames)
+func_fromInteger = (HsVar $ V.func_fromInteger uqFuncNames)
+func_fromRational = (HsVar $ V.func_fromRational uqFuncNames)
hunk ./FrontEnd/Rename.hs 787
-desugarEnum s as = foldl HsApp (HsVar (hsUnqualValName s)) as
+desugarEnum s as = foldl HsApp (HsVar (nameName $ toName Val s)) as
hunk ./FrontEnd/Rename.hs 792
-    pe <- wrapInAsPat (HsVar (hsValName ("Prelude","error")))
+    pe <- wrapInAsPat (HsVar (nameName v_error))
hunk ./FrontEnd/Rename.hs 940
-        | Just n <- fromTupname hsName -> return hsName
+        | Just n <- V.fromTupname hsName -> return hsName
hunk ./FrontEnd/Rename.hs 1342
-                HsEVar  # name			
+                HsEVar  # name
hunk ./FrontEnd/Rename.hs 1344
-                HsEAbs  # name			
+                HsEAbs  # name
hunk ./FrontEnd/Rename.hs 1346
-                HsEThingAll  # name		
+                HsEThingAll  # name
hunk ./FrontEnd/Rename.hs 1348
-                HsEThingWith  # name # names	
+                HsEThingWith  # name # names
hunk ./FrontEnd/Rename.hs 1350
-                HsEModuleContents mod	
+                HsEModuleContents mod
hunk ./FrontEnd/Rename.hs 1369
-                HsIVar  # name			
+                HsIVar  # name
hunk ./FrontEnd/Rename.hs 1371
-                HsIAbs  # name			
+                HsIAbs  # name
hunk ./FrontEnd/Rename.hs 1373
-                HsIThingAll  # name		
+                HsIThingAll  # name
hunk ./FrontEnd/Rename.hs 1375
-                HsIThingWith  # name # names	
+                HsIThingWith  # name # names
hunk ./FrontEnd/Rename.hs 1561
-                HsAsPat  # name # exp		
+                HsAsPat  # name # exp
hunk ./FrontEnd/Rename.hs 1563
-                HsWildCard sl			
+                HsWildCard sl
hunk ./FrontEnd/Rename.hs 1565
-                HsIrrPat  # exp		
+                HsIrrPat  # exp
hunk ./FrontEnd/Representation.hs 37
+import Control.Monad.Trans
+import Data.Generics
+import Data.IORef
+import qualified Data.Map as Map
+import Text.PrettyPrint.HughesPJ(nest,Doc)
+
hunk ./FrontEnd/Representation.hs 45
-import Data.Generics
hunk ./FrontEnd/Representation.hs 48
+import Name.Name
+import Name.Names
+import Name.VConsts
hunk ./FrontEnd/Representation.hs 52
-import qualified Data.Map as Map
hunk ./FrontEnd/Representation.hs 54
-import Text.PrettyPrint.HughesPJ(nest,Doc)
-import Control.Monad.Trans
hunk ./FrontEnd/Representation.hs 55
-import VConsts
-import Data.IORef
hunk ./FrontEnd/Representation.hs 71
-    tBool = TCon (Tycon (Qual (Module "Prelude") (HsIdent "Bool")) Star)
+    tBool = TCon (Tycon (nameName tc_Bool) Star)
hunk ./FrontEnd/Representation.hs 73
-    tChar      = TCon (Tycon (Qual (Module "Prelude") (HsIdent "Char")) Star)
-    tUnit = TCon (Tycon (Qual (Module "Prelude") (HsIdent "()")) Star)
+    tChar      = TCon (Tycon (nameName tc_Char) Star)
+    tUnit = TCon (Tycon (nameName tc_Unit) Star)
hunk ./FrontEnd/Representation.hs 76
-tList = TCon (Tycon (Qual (Module "Prelude") (HsIdent "[]")) (Kfun Star Star))
+tList = TCon (Tycon (nameName tc_List) (Kfun Star Star))
hunk ./FrontEnd/Representation.hs 363
-getTypeCons (TArrow {}) = Qual (Module "Prelude") $ HsIdent "->"
+getTypeCons (TArrow {}) = nameName tc_Arrow
hunk ./FrontEnd/TIMain.hs 48
-import VConsts
+import Name.VConsts
hunk ./FrontEnd/TIModule.hs 26
-import MonoidUtil
+import Util.Inst()
+import Util.Gen
hunk ./FrontEnd/TIModule.hs 29
-import Name
+import Name.Name as Name
hunk ./FrontEnd/Type.hs 53
-import VConsts
+import Name.VConsts
hunk ./FrontEnd/TypeSynonyms.hs 19
-import Name
+import Name.Name
hunk ./FrontEnd/Utils.hs 23
-import VConsts
-import Name()
+import Name.VConsts
+import Name.Names
+import Name.Name
hunk ./FrontEnd/Utils.hs 106
-nameOfTyCon (HsTyFun _ _) = hsTypName ("Prelude","->")
+nameOfTyCon (HsTyFun _ _) = nameName tc_Arrow
hunk ./Grin/DeadFunctions.hs 20
-import MonoidUtil()
+import Util.Inst()
hunk ./Grin/FromE.hs 31
-import Name
+import Name.Name
+import Name.Names
+import Name.VConsts
hunk ./Grin/FromE.hs 41
-import VConsts
hunk ./Grin/Grin.hs 59
-import VConsts
+import Name.VConsts
hunk ./Grin/Interpret.hs 16
-import VConsts
+import Name.VConsts
hunk ./Grin/PointsToAnalysis.hs 27
-import UniqueMonad
+import Util.UniqueMonad
hunk ./Grin/Primitives.hs 6
-import VConsts
+import Name.VConsts
hunk ./Grin/Show.hs 9
-import VConsts
+import Name.VConsts
hunk ./Grin/Simplify.hs 16
-import MonoidUtil()
+import Util.Inst()
hunk ./Grin/Val.hs 6
-import VConsts
+import Name.VConsts
hunk ./Ho.hs 48
-import Name
+import Name.Name
hunk ./Main.hs 50
-import Name
+import Name.Name
hunk ./Name/Name.hs 1
-module Name(
+module Name.Name(
hunk ./Name/Name.hs 6
-    nameValue,
hunk ./Name/Name.hs 9
-    toPlainAtom,
-    nameTuple,
hunk ./Name/Name.hs 14
-    unboxedNameTuple,
-    fromUnboxedNameTuple,
hunk ./Name/Name.hs 29
-import VConsts
hunk ./Name/Name.hs 57
-instance ValName Name where
-    hsValName (a,b) = toName Val (a,b)
-    hsTypName (a,b) = toName TypeVal (a,b)
-    hsUnqualTypName b = toName TypeVal b
-
-instance ValName HsName where
-    hsValName (a,b) = Qual (Module a) $ HsIdent b
-    hsUnqualValName b = UnQual $ HsIdent b
-
-
-
-
hunk ./Name/Name.hs 120
---parseName t name = if not (null ms) then toName t (concatInter "." ms, concatInter "." (ns ++ [last sn])) else toName t (concatInter "." (ns ++ [last sn])) where
hunk ./Name/Name.hs 127
-
-
hunk ./Name/Name.hs 136
-
hunk ./Name/Name.hs 139
-toPlainAtom a = toAtom (show a)
-
-hsname m n = (m,n) -- Qual (Module m) $ HsIdent n
-
-
-nameTuple _ n | n < 2 = error "attempt to create tuple of length < 2"
-nameTuple t n = toName t  $ (toTuple n:: (String,String)) -- Qual (HsIdent ("(" ++ replicate (n - 1) ',' ++ ")"))
-
-unboxedNameTuple t n = toName t $ "(#" ++ show n ++ "#)"
-
-fromUnboxedNameTuple n = case show n of
-    '(':'#':xs | (ns@(_:_),"#)") <- span isDigit xs -> return (read ns::Int)
-    _ -> fail $ "Not unboxed tuple: " ++ show n
-
-
-
-instance TypeNames Name where
-    tInt = toName TypeConstructor $ hsname "Prelude" "Int"
-    tBool = toName TypeConstructor $ hsname "Prelude" "Bool"
-    tInteger = toName TypeConstructor $ hsname "Prelude" "Integer"
-    --tRational = toName TypeConstructor $ hsname "Ratio" "Rational"
-    tChar = toName TypeConstructor $ hsname "Prelude" "Char"
-    tStar = toName SortName $ hsname "Jhc@" "*"
-    tHash = toName SortName $ hsname "Jhc@" "#"
-    tUnit = toName TypeConstructor $ hsname "Prelude" "()"
-    tIntzh = toName RawType "int"
-    tCharzh = toName RawType "uint32_t"
-    tIntegerzh = toName RawType "intmax_t"
-    tWorld__ = toName TypeConstructor $ hsname "Jhc.IO" "World__"
-
-instance ConNames Name where
-    vTrue = toName DataConstructor $ hsname "Prelude" "True"
-    vFalse = toName DataConstructor $ hsname "Prelude" "False"
-    vEmptyList = toName DataConstructor $ hsname "Prelude" "[]"
-    vUnit = toName DataConstructor $ hsname "Prelude" "()"
-    vCons = toName DataConstructor $ hsname "Prelude" ":"
-
-instance ToTuple Name where
-    toTuple n = toName DataConstructor (toTuple n :: (String,String))
-
-
hunk ./Name/Name.hs 142
-{-
-instance ClassNames Name where
-    classEq :: a
-    classOrd :: a
-    classEnum :: a
-    classBounded :: a
-    classShow :: a
-    classRead :: a
-    classIx :: a
-    classFunctor :: a
-    classMonad :: a
-    classNum  :: a
-    classReal :: a
-    classIntegral :: a
-    classFractional :: a
-    classFloating :: a
-    classRealFrac :: a
-    classRealFloat :: a
-
--}
-
-nameValue m n = atomIndex $ toAtom (toName Val (m,n))
-
hunk ./Name/Name.hs 147
-
hunk ./Name/Names.hs 1
+-- | All hardcoded names in the compiler should go in here
+-- the convention is
+-- v_foo for values
+-- tc_foo for type constructors
+-- dc_foo for data constructors
+-- s_foo for sort names
+-- rt_foo for raw names
+
+module Name.Names where
+
+import Char(isDigit)
+
+import Name.VConsts
+import Name.Name
+
+instance TypeNames Name where
+    tInt = tc_Int
+    tBool = tc_Bool
+    tInteger = tc_Integer
+    tChar = tc_Char
+    tStar = s_Star
+    tHash = s_Hash
+    tUnit = tc_Unit
+    tIntzh = rt_int
+    tCharzh = rt_uint32_t
+    tIntegerzh = rt_intmax_t
+    tWorld__ = tc_World__
+
+instance ConNames Name where
+    vTrue = dc_True
+    vFalse = dc_False
+    vEmptyList = dc_EmptyList
+    vUnit = dc_Unit
+    vCons = dc_Cons
+
+{-
+-- These should go away
+instance ValName Name where
+    hsValName (a,b) = toName Val (a,b)
+    hsTypName (a,b) = toName TypeVal (a,b)
+    hsUnqualTypName b = toName TypeVal b
+
+instance ValName HsName where
+    hsValName (a,b) = Qual (Module a) $ HsIdent b
+    hsUnqualValName b = UnQual $ HsIdent b
+-}
+
+-- Tuple handling
+
+instance ToTuple Name where
+    toTuple n = toName DataConstructor (toTuple n :: (String,String))
+
+nameTuple _ n | n < 2 = error "attempt to create tuple of length < 2"
+nameTuple t n = toName t  $ (toTuple n:: (String,String)) -- Qual (HsIdent ("(" ++ replicate (n - 1) ',' ++ ")"))
+
+unboxedNameTuple t n = toName t $ "(#" ++ show n ++ "#)"
+fromUnboxedNameTuple n = case show n of
+    '(':'#':xs | (ns@(_:_),"#)") <- span isDigit xs -> return (read ns::Int)
+    _ -> fail $ "Not unboxed tuple: " ++ show n
+
+
+-- The constructors
+
+dc_Addr = toName DataConstructor ("Jhc.Addr","Addr")
+dc_Char = toName DataConstructor ("Prelude","Char")
+dc_Cons = toName DataConstructor ("Prelude",":")
+dc_EmptyList = toName DataConstructor ("Prelude","[]")
+dc_False = toName DataConstructor ("Prelude","False")
+dc_Integer = toName DataConstructor ("Prelude","Integer")
+dc_Int = toName DataConstructor ("Prelude","Int")
+dc_JustIO = toName DataConstructor ("Jhc.IO", "JustIO")
+dc_Rational = toName DataConstructor ("Ratio",":%")
+dc_True = toName DataConstructor ("Prelude","True")
+dc_Unit = toName DataConstructor ("Prelude","()")
+dc_World__ = toName DataConstructor ("Jhc.IO","World__")
+
+tc_Absurd = toName TypeConstructor ("Jhc@","Absurd#")
+tc_Arrow = toName TypeConstructor ("Jhc@","->")
+tc_IOResult = toName TypeConstructor ("Jhc.IO","IOResult")
+tc_IO = toName TypeConstructor ("Jhc.IO", "IO")
+tc_List = toName TypeConstructor ("Prelude","[]")
+tc_Ptr = toName TypeConstructor ("Foreign.Ptr","Ptr")
+tc_World__ = toName TypeConstructor ("Jhc.IO","World__")
+
+tc_Int = toName TypeConstructor ("Prelude","Int")
+tc_Bool = toName TypeConstructor ("Prelude","Bool")
+tc_Integer = toName TypeConstructor ("Prelude","Integer")
+tc_Double = toName TypeConstructor ("Prelude","Double")
+tc_Char = toName TypeConstructor ("Prelude","Char")
+tc_Unit = toName TypeConstructor  ("Prelude","()")
+
+rt_int = toName RawType "int"
+rt_uint32_t = toName RawType "uint32_t"
+rt_intmax_t = toName RawType "intmax_t"
+s_Star = toName SortName ("Jhc@","*")
+s_Hash = toName SortName ("Jhc@","#")
+
+v_error = toName Val ("Prelude","error")
+v_toEnum = toName Val ("Prelude","toEnum")
+v_fromEnum = toName Val ("Prelude","fromEnum")
+v_minBound = toName Val ("Prelude","minBound")
+v_maxBound = toName Val ("Prelude","maxBound")
+v_fail = toName Val ("Prelude","fail")
+v_concatMap = toName Val ("Prelude","concatMap")
+
+sFuncNames = FuncNames {
+    func_bind = toName Val ("Prelude",">>="),
+    func_bind_ = toName Val ("Prelude",">>"),
+    func_negate = toName Val ("Prelude","negate"),
+    func_runMain = toName Val ("Prelude.IO","runMain"),
+    func_fromInt = toName Val ("Prelude","fromInt"),
+    func_fromInteger = toName Val ("Prelude","fromInteger"),
+    func_fromRational = toName Val ("Prelude","fromRational"),
+    func_runExpr = toName Val ("Prelude.IO","runExpr"),
+    func_equals = toName Val ("Prelude","=="),
+    func_concatMap = toName Val ("Prelude","concatMap")
+    }
+
hunk ./Name/VConsts.hs 1
-module VConsts where
+module Name.VConsts where
hunk ./Name/VConsts.hs 74
---class Tupleable a where
---    toTuple :: [a] -> a
-
hunk ./Name/VConsts.hs 93
-
-class ValName a where
-    hsValName :: (String,String) -> a
-    hsUnqualValName :: String -> a
-    hsTypName ::  (String,String) -> a
-    hsUnqualTypName :: String -> a
-
-    hsUnqualValName s = hsValName ("",s)
-    hsTypName = hsValName
-    hsUnqualTypName = hsUnqualValName
hunk ./Name/VConsts.hs 110
-sFuncNames = FuncNames {
-    func_bind = ("Prelude",">>="),
-    func_bind_ = ("Prelude",">>"),
-    func_negate = ("Prelude","negate"),
-    func_runMain = ("Prelude.IO","runMain"),
-    func_fromInt = ("Prelude","fromInt"),
-    func_fromInteger = ("Prelude","fromInteger"),
-    func_fromRational = ("Prelude","fromRational"),
-    func_runExpr = ("Prelude.IO","runExpr"),
-    func_equals = ("Prelude","=="),
-    func_concatMap = ("Prelude","concatMap")
-    }
hunk ./SelfTest.hs 10
-import ArbitraryInstances()
+import Util.ArbitraryInstances()
hunk ./SelfTest.hs 21
-import Name
+import Name.Name
+import Name.Names
hunk ./SelfTest.hs-boot 3
-import ArbitraryInstances()
hunk ./Util/ArbitraryInstances.hs 1
-module ArbitraryInstances() where
+module Util.ArbitraryInstances() where
hunk ./Util/ContextMonad.hs 1
-module MonadUtil where
+module Util.ContextMonad where
hunk ./Util/ContextMonad.hs 11
---class Monad m => UniqueProducerMonad m where
---    newUniq :: m Int
hunk ./Util/ContextMonad.hs 26
-
-
-instance Show a => Show (Identity a) where
-    show x = show $ runIdentity x
hunk ./Util/Gen.hs 1
+
+-- | similar to GenUtil but can rely on non-haskell 98 features
+module Util.Gen where
+
+import Data.Monoid
+import List
+
+mconcatMap f xs = mconcat (map f xs)
+mconcatInter x xs = mconcat (intersperse x xs)
hunk ./Util/Inst.hs 1
-module MonoidUtil where
hunk ./Util/Inst.hs 2
+-- Useful instances that don't belong anywhere else.
+module Util.Inst() where
+
+import Control.Monad.Identity
hunk ./Util/Inst.hs 9
-infixr 6 <>
hunk ./Util/Inst.hs 10
-empty :: Monoid a => a
-empty = mempty
-(<>) :: Monoid a => a -> a -> a
-(<>) = mappend
-
-
hunk ./Util/Inst.hs 14
---instance (Monoid a, Monoid b) => Monoid (a,b) where
---    mempty = (mempty,mempty)
---    mappend (a,b) (c,d) = (mappend a c, mappend b d)
---    mconcat xs = case unzip xs of (a,b) -> (mconcat a,mconcat b)
---
---instance (Monoid a, Monoid b, Monoid c) => Monoid (a,b,c) where
---    mempty = (mempty,mempty,mempty)
---    mappend (a,b,c) (a',b',c') = (mappend a a', mappend b b', mappend c c')
---    mconcat xs = case unzip3 xs of (a,b,c) -> (mconcat a,mconcat b,mconcat c)
-
hunk ./Util/Inst.hs 19
-mconcatMap f xs = mconcat (map f xs)
-mconcatInter x xs = mconcat (intersperse x xs)
hunk ./Util/Inst.hs 20
+instance Show a => Show (Identity a) where
+    show x = show $ runIdentity x
hunk ./Util/Inst.hs 23
-class  QueryMonoid a where
-    isEmpty :: a -> Bool
-
-
-instance  QueryMonoid (Maybe a) where
-    isEmpty Nothing = True
-    isEmpty _ = False
-
-instance  QueryMonoid [a] where
-    isEmpty = null
-
-instance QueryMonoid Bool where
-    isEmpty = not
-
-instance QueryMonoid () where
-    isEmpty _ = True
hunk ./Util/NameMonad.hs 1
-module NameMonad(NameMonad(..), GenName(..), NameMT, runNameMT, runNameMT', freeNames) where
+module Util.NameMonad(NameMonad(..), GenName(..), NameMT, runNameMT, runNameMT', freeNames) where
hunk ./Util/NameMonad.hs 7
-import Atom
hunk ./Util/NameMonad.hs 37
-
-instance GenName Atom where
-    genNames i = map (toAtom . show) [abs i..]
hunk ./Util/README 1
+This is a collection of useful utility modules. they should be generally useful
+(not just jhc) and depend only on the hierarchical libs.
hunk ./Util/UniqueMonad.hs 1
-module UniqueMonad(UniqT,Uniq, runUniq, runUniqT, execUniq1, execUniq, execUniqT) where
+module Util.UniqueMonad(UniqT,Uniq, runUniq, runUniqT, execUniq1, execUniq, execUniqT) where
hunk ./data/PrimitiveOperators-in.hs 13
-import Name
+import Name.Name
+import Name.Names
hunk ./data/PrimitiveOperators-in.hs 16
-import VConsts
+import Name.VConsts