[move Module to containing an atom instead of a string
John Meacham <john@repetae.net>**20120129154925
 Ignore-this: f119ccadc9be980d5ab5ac4ed8b76bdb
] hunk ./Makefile.am 53
-GHCLANG= -XTypeFamilies -XViewPatterns -XUndecidableInstances -XOverlappingInstances -XRecordWildCards -XRecursiveDo -XTupleSections -XParallelListComp -XGeneralizedNewtypeDeriving -XScopedTypeVariables -XFlexibleInstances -XTypeSynonymInstances -XMultiParamTypeClasses -XDeriveDataTypeable -fglasgow-exts -XNoMonoLocalBinds
+GHCLANG= -XTypeFamilies -XViewPatterns -XUndecidableInstances -XOverlappingInstances \
+	-XRecordWildCards -XRecursiveDo -XTupleSections -XParallelListComp \
+	-XGeneralizedNewtypeDeriving -XScopedTypeVariables -XFlexibleInstances \
+	-XTypeSynonymInstances -XMultiParamTypeClasses -XDeriveDataTypeable \
+	-fglasgow-exts -XNoMonoLocalBinds
+
hunk ./Makefile.am 261
-
hunk ./src/E/FromHs.hs 26
-import E.PrimDecode
hunk ./src/E/FromHs.hs 27
-import E.PrimOpt
+import E.PrimDecode
hunk ./src/E/FromHs.hs 196
-        rule t = makeRule ("Rule.{" ++ show name ++ "}") (Module (show name),0) RuleSpecialization ruleFvs methodVar (vp:map EVar args) (removeNewtypes dataTable body)  where
+        rule t = makeRule ("Rule.{" ++ show name ++ "}") (toModule (show name),0) RuleSpecialization ruleFvs methodVar (vp:map EVar args) (removeNewtypes dataTable body)  where
hunk ./src/E/FromHs.hs 1013
-        (ntype,Just m,q) = nameParts nn
-        newName = toName ntype (Just $ "Spec@." ++ m ++ "." ++ show ui,'f':m ++ "." ++ q)
+        (ntype,Just (show -> m),q) = nameParts nn
+        newName = toName ntype (Just $ toModule ("Spec@." ++ m ++ "." ++ show ui),'f':m ++ "." ++ q)
hunk ./src/E/FromHs.hs 1016
-        ar = makeRule ("Specialize.{" ++ show newName) (Module m,ui) RuleSpecialization bvars t as (foldl eAp (EVar ntvr) (map EVar bvars))
+        ar = makeRule ("Specialize.{" ++ show newName) (toModule m,ui) RuleSpecialization bvars t as (foldl eAp (EVar ntvr) (map EVar bvars))
hunk ./src/E/PrimDecode.hs 59
+    , "options_target" ==> hash
hunk ./src/E/PrimOpt.hs 5
-import Data.Maybe
-import Text.Printf
hunk ./src/E/PrimOpt.hs 7
-import Cmm.Op(readTy,Ty)
hunk ./src/E/PrimOpt.hs 9
-import DataConstructors
hunk ./src/E/PrimOpt.hs 13
-import GenUtil
hunk ./src/E/PrimOpt.hs 16
-import Support.FreeVars
hunk ./src/FrontEnd/Desugar.hs 33
-newPatVarName = nameName $ toName Val "patvar@0"
+newPatVarName = nameName $ toName Val ("patvar@0"::String)
hunk ./src/FrontEnd/Desugar.hs 116
-       a2 =  HsAlt sloc HsPWildCard (HsUnGuardedRhs (HsApp (HsVar (toName Val "error")) (HsLit $ HsString $ show sloc ++ " failed pattern match"))) []
+       a2 =  HsAlt sloc HsPWildCard (HsUnGuardedRhs (HsApp (HsVar (toName Val ("error"::String))) (HsLit $ HsString $ show sloc ++ " failed pattern match"))) []
hunk ./src/FrontEnd/Exports.hs 44
-        | any ((== Module "Prelude") . hsImportDeclModule) xs = xs
+        | any ((== toModule "Prelude") . hsImportDeclModule) xs = xs
hunk ./src/FrontEnd/Exports.hs 47
-    prelude = HsImportDecl { hsImportDeclSrcLoc = bogusASrcLoc, hsImportDeclModule = Module "Prelude", hsImportDeclSpec = Nothing, hsImportDeclAs = Nothing, hsImportDeclQualified = False }
+    prelude = HsImportDecl {
+        hsImportDeclSrcLoc = bogusASrcLoc,
+        hsImportDeclModule = toModule "Prelude",
+        hsImportDeclSpec = Nothing,
+        hsImportDeclAs = Nothing,
+        hsImportDeclQualified = False }
hunk ./src/FrontEnd/FrontEnd.hs 13
-import FrontEnd.SrcLoc
-import FrontEnd.Warning
hunk ./src/FrontEnd/FrontEnd.hs 14
-import Name.Name
hunk ./src/FrontEnd/HsParser.y 1
-{-# OPTIONS_GHC -w #-} {- -*- Haskell -*- -}
+{-# OPTIONS_GHC -w -XNoOverloadedStrings #-} {- -*- Haskell -*- -}
hunk ./src/FrontEnd/HsParser.y 1036
-      : CONID                 { Module $1 }
-      | QCONID                { Module (fst $1 ++ "." ++ snd $1) }
+      : CONID                 { toModule $1 }
+      | QCONID                { toModule (fst $1 ++ "." ++ snd $1) }
hunk ./src/FrontEnd/HsParser.y 1077
-prelude_mod	      = Module "Prelude"
-main_mod	      = Module "Main"
+prelude_mod	      = toModule "Prelude"
+main_mod	      = toModule "Main"
hunk ./src/FrontEnd/HsParser.y 1080
-tuple_con_name i      = toName DataConstructor ("Jhc.Prim.Prim","("++replicate i ','++")")
+tuple_con_name i      = toName DataConstructor (toModule "Jhc.Prim.Prim","("++replicate i ','++")")
hunk ./src/FrontEnd/HsParser.y 1093
-toUnqualName n = toName UnknownType (Nothing :: Maybe String,n)
+toUnqualName n = toName UnknownType (Nothing :: Maybe Module,n)
hunk ./src/FrontEnd/HsPretty.hs 190
-		 text modName,
+		 text $ show modName,
hunk ./src/FrontEnd/HsPretty.hs 200
-ppHsExportSpec (HsEModuleContents (Module name)) = text "module" <+> text name
+ppHsExportSpec (HsEModuleContents (show -> name)) = text "module" <+> text name
hunk ./src/FrontEnd/HsPretty.hs 202
-ppHsImportDecl (HsImportDecl pos (Module mod) bool mbName mbSpecs) =
+ppHsImportDecl (HsImportDecl pos (show -> mod) bool mbName mbSpecs) =
hunk ./src/FrontEnd/HsPretty.hs 206
-		 maybePP (\(Module n) -> text "as" <+> text n) mbName,
+		 maybePP (\(show -> n) -> text "as" <+> text n) mbName,
hunk ./src/FrontEnd/Rename.hs 38
-    (Map.Map Name Int)             -- a map of data constructors to their arities
-    (Map.Map Name [(Name,Int)])    -- a map of field labels to ...
+    !(Map.Map Name Int)          -- a map of data constructors to their arities
+    !(Map.Map Name [(Name,Int)]) -- a map of field labels to ...
hunk ./src/FrontEnd/Rename.hs 43
-    mappend (FieldMap a b) (FieldMap c d) = FieldMap (a `mappend` c) (b `mappend` d)
+    mappend (FieldMap a b) (FieldMap c d) =
+        FieldMap (a `mappend` c) (b `mappend` d)
hunk ./src/FrontEnd/Rename.hs 72
-            | Just _ <- V.fromTupname hsName, Module "Jhc.Prim.Prim" <- mod
+            | Just _ <- V.fromTupname hsName, toModule "Jhc.Prim.Prim" == mod
hunk ./src/FrontEnd/Rename.hs 74
-            | nameName tc_Arrow == hsName, Module "Jhc.Prim.Prim" == mod
+            | nameName tc_Arrow == hsName, toModule "Jhc.Prim.Prim" == mod
hunk ./src/FrontEnd/Rename.hs 677
-    | (nt,Just ('@':m),i) <- nameParts hsName = return $ toName nt (Module m, i)
+    | (nt,Just m,i) <- nameParts hsName, '@':_ <- show m = return $ toName nt (m, i)
hunk ./src/FrontEnd/Representation.hs 182
-   pprint (Module s) = text s
+   pprint (Module s) = tshow s
hunk ./src/FrontEnd/Tc/Main.hs 131
-isTypePlaceholder (getModule -> Just (Module m)) = m `elem` ["Wild@","As@"]
+isTypePlaceholder (getModule -> Just m) = m `elem` [toModule "Wild@",toModule "As@"]
hunk ./src/Ho/Build.hs 620
-hsModuleRequires x = snub (Module "Jhc.Prim.Prim":ans) where
+hsModuleRequires x = snub (toModule "Jhc.Prim.Prim":ans) where
hunk ./src/Ho/Build.hs 623
-    ans = (if noPrelude then id else  (Module "Prelude":)) [  hsImportDeclModule y | y <- hsModuleImports x]
+    ans = (if noPrelude then id else (preludeModule:)) [  hsImportDeclModule y | y <- hsModuleImports x]
hunk ./src/Ho/Build.hs 729
-        let hmods = map Module $ snub $ mfield "hidden-modules"
-            emods = map Module $ snub $ mfield "exposed-modules"
+        let hmods = map toModule $ snub $ mfield "hidden-modules"
+            emods = map toModule $ snub $ mfield "exposed-modules"
hunk ./src/Interactive.hs 73
-    stateModule = Module "Main",
+    stateModule = mainModule,
hunk ./src/Interactive.hs 144
-    isStart =  isInitial { stateHo = hoE, stateImports = runIdentity $ calcImports hoE False (Module "Prelude") }
+    isStart =  isInitial { stateHo = hoE, stateImports = runIdentity $ calcImports hoE False preludeModule }
hunk ./src/Main.hs 56
-        g [Left (Module "Prelude")]
+        g [Left preludeModule]
hunk ./src/Main.hs 67
-        _                   -> Left $ Module f
+        _                   -> Left $ toModule f
hunk ./src/Name/Name.hs 1
+{-# LANGUAGE OverloadedStrings #-}
hunk ./src/Name/Name.hs 3
-    NameType(..),
+    Module(..),
hunk ./src/Name/Name.hs 5
-    nameName,
-    nameType,
-    getModule,
-    getIdent,
-    toUnqualified,
-    qualifyName,
+    NameType(..),
hunk ./src/Name/Name.hs 7
+    ffiExportName,
+    fromModule,
hunk ./src/Name/Name.hs 11
-    parseName,
-    ffiExportName,
+    getIdent,
+    getModule,
hunk ./src/Name/Name.hs 14
-    Module(..),
-    fromModule,
hunk ./src/Name/Name.hs 17
-    primModule,
-    nameParts,
+    preludeModule,
hunk ./src/Name/Name.hs 19
-    setModule
+    nameName,
+    nameParts,
+    nameType,
+    parseName,
+    primModule,
+    qualifyName,
+    setModule,
+    toModule,
+    toUnqualified
hunk ./src/Name/Name.hs 87
-createName _ "" i = error $ "createName: empty module "  ++ i
-createName _ m "" = error $ "createName: empty ident "   ++ m
-createName t m i = Name $  toAtom $ (chr $  ord '1' + fromEnum t):m ++ ";" ++ i
+createName :: NameType -> Module -> String -> Name
+createName _ (Module "") i = error $ "createName: empty module " ++ i
+createName _ m "" = error $ "createName: empty ident " ++ show m
+createName t m i = Name $ toAtom $ (chr $ ord '1' + fromEnum t):show m ++ ";" ++ i
+
hunk ./src/Name/Name.hs 100
---instance ToName HsName where
---    toName nt n = m where
---        i = hsIdentString $ hsNameIdent n
---        m | Qual (Module m) _ <- n = createName nt m i
---          | otherwise = createUName nt i
---    fromName n = (nameType n, nameName n)
-
hunk ./src/Name/Name.hs 101
-    toName nt (m,i) = createName nt m i
+    toName nt (m,i) = createName nt (Module $ toAtom m) i
hunk ./src/Name/Name.hs 103
-            (nt,Just m,i) -> (nt,(m,i))
+            (nt,Just (Module m),i) -> (nt,(show m,i))
hunk ./src/Name/Name.hs 107
-    toName nt (Module m,i) = createName nt m i
+    toName nt (m,i) = createName nt m i
hunk ./src/Name/Name.hs 109
-            (nt,Just m,i) -> (nt,(Module m,i))
+            (nt,Just m,i) -> (nt,(m,i))
hunk ./src/Name/Name.hs 112
-instance ToName (Maybe String,String) where
-    toName nt (Just m,i) = createName nt m i
-    toName nt (Nothing,i) = createUName nt i
-    fromName n = case nameParts n of
-        (nt,a,b) -> (nt,(a,b))
+--instance ToName (Maybe String,String) where
+--    toName nt (Just m,i) = createName nt m i
+--    toName nt (Nothing,i) = createUName nt i
+--    fromName n = case nameParts n of
+--        (nt,a,b) -> (nt,(a,b))
hunk ./src/Name/Name.hs 119
-    toName nt (Just (Module m),i) = createName nt m i
+    toName nt (Just m,i) = createName nt m i
hunk ./src/Name/Name.hs 122
-        (nt,a,b) -> (nt,(fmap Module a,b))
+        (nt,a,b) -> (nt,(a,b))
hunk ./src/Name/Name.hs 133
-            (Just m,i) -> m ++ "." ++ i
+            (Just (Module m),i) -> show m ++ "." ++ i
hunk ./src/Name/Name.hs 138
-    (_,Just m,_)  -> return (Module m)
+    (_,Just m,_) -> return m
hunk ./src/Name/Name.hs 148
-    (t,Just _,i) -> toName t (Nothing :: Maybe String,i)
+    (t,Just _,i) -> toName t (Nothing :: Maybe Module,i)
hunk ./src/Name/Name.hs 175
-nameParts :: Name -> (NameType,Maybe String,String)
+nameParts :: Name -> (NameType,Maybe Module,String)
hunk ./src/Name/Name.hs 178
-    f xs = (nameType n,Just a,b) where
+    f xs = (nameType n,Just $ Module (toAtom a),b) where
hunk ./src/Name/Name.hs 183
-        (_,Just a,b) -> showString a . showChar '.' . showString b
+        (_,Just a,b) -> shows a . showChar '.' . showString b
hunk ./src/Name/Name.hs 189
-mapName :: (String -> String,String -> String) -> Name -> Name
+mapName :: (Module -> Module,String -> String) -> Name -> Name
hunk ./src/Name/Name.hs 192
-    (nt,Just m,i) -> toName nt (Just (f m :: String),g i)
+    (nt,Just m,i) -> toName nt (Just (f m :: Module),g i)
hunk ./src/Name/Name.hs 196
+preludeModule = Module "Prelude"
+
+toModule :: String -> Module
+toModule s = Module $ toAtom s
hunk ./src/Name/Name.hs 202
-ffiExportName (FfiExport cn _ cc _ _) = toName Val ("FE@", show cc ++ "." ++ cn)
+ffiExportName (FfiExport cn _ cc _ _) = toName Val (Module "FE@", show cc ++ "." ++ cn)
+
+newtype Module = Module Atom
+  deriving(Eq,Data,Typeable,ToAtom,FromAtom)
hunk ./src/Name/Name.hs 207
-newtype Module = Module String
-  deriving(Eq,Data,Typeable,Ord,ToAtom,FromAtom)
+instance Ord Module where
+    compare x y = show x `compare` show y
hunk ./src/Name/Name.hs 211
-    showsPrec _ (Module n) = showString n
+    showsPrec _ (Module n) = shows n
hunk ./src/Name/Name.hs 213
-fromModule (Module s) = s
+fromModule (Module s) = fromAtom s
hunk ./src/Name/Names.hs 1
+{-# LANGUAGE OverloadedStrings #-}
hunk ./src/Name/Names.hs 44
-    fromTupname name | m == "Jhc.Prim.Prim" = fromTupname (nn::String) where
+    fromTupname name | m == Module "Jhc.Prim.Prim" = fromTupname (nn::String) where
hunk ./src/Name/Names.hs 48
-s_Star = toName SortName ("Jhc@","*")
-s_Hash = toName SortName ("Jhc@","#")
-s_Bang = toName SortName ("Jhc@","!")
-s_Quest = toName SortName ("Jhc@","?")
-s_QuestQuest = toName SortName ("Jhc@","??")
-s_StarBang = toName SortName ("Jhc@","*!")
+s_Star = toName SortName (Module "Jhc@","*"::String)
+s_Hash = toName SortName (Module "Jhc@","#"::String)
+s_Bang = toName SortName (Module "Jhc@","!"::String)
+s_Quest = toName SortName (Module "Jhc@","?"::String)
+s_QuestQuest = toName SortName (Module "Jhc@","??"::String)
+s_StarBang = toName SortName (Module "Jhc@","*!"::String)
hunk ./src/Name/Names.hs 55
-u_instance = toName UnknownType ("Jhc@","instance")
+u_instance = toName UnknownType (Module "Jhc@","instance"::String)
hunk ./src/Stats.hs 26
+    mtick',
hunk ./src/Stats.hs 149
+mtick' k = mticks' 1 k
hunk ./utils/op_names.prl 12
-
hunk ./utils/op_names.prl 22
-
hunk ./utils/op_names.prl 24
+print "{-# Language NoOverloadedStrings #-}\n";
hunk ./utils/op_names.prl 29
-
hunk ./utils/op_names.prl 82
-
hunk ./utils/op_names.prl 83
-
-