Fix some inconsistencies in the code and docs of primitives
[ghc-hetmet.git] / utils / genprimopcode / Main.hs
index e923755..24820d8 100644 (file)
@@ -190,8 +190,9 @@ gen_ext_core_source entries =
    ++ "-- This module is automatically generated by the GHC utility\n"
    ++ "-- \"genprimopcode\". Do not edit!\n"
    ++ "-----------------------------------------------------------------------\n"
-   ++ "module PrimEnv(primTcs, primVals, intLitTypes, ratLitTypes,\n"
-   ++ "    charLitTypes, stringLitTypes) where\nimport Core\nimport Encoding\n\n"
+   ++ "module Language.Core.PrimEnv(primTcs, primVals, intLitTypes, ratLitTypes,"
+   ++ "\n charLitTypes, stringLitTypes) where\nimport Language.Core.Core"
+   ++ "\nimport Language.Core.Encoding\n\n"
    ++ "primTcs :: [(Tcon, Kind)]\n"
    ++ "primTcs = [\n"
    ++ printList tcEnt entries 
@@ -278,10 +279,6 @@ gen_ext_core_source entries =
 
         -- more hacks. might be better to do this on the ext-core side,
         -- as per earlier comment
-        qualify _ tc | tc == "ByteArr#" = qualify True "ByteArray#"
-        qualify _ tc | tc == "MutArr#" = qualify True "MutableArray#"
-        qualify _ tc | tc == "MutByteArr#" = 
-                     qualify True "MutableByteArray#"
         qualify _ tc | tc == "Bool" = "Just boolMname" ++ ", " 
                                                 ++ ze True tc
         qualify _ tc | tc == "()"  = "Just baseMname" ++ ", "
@@ -464,9 +461,9 @@ gen_latex_doc (Info defaults entries)
 
 gen_wrappers :: Info -> String
 gen_wrappers (Info _ entries)
-   = "{-# OPTIONS -fno-implicit-prelude #-}\n" 
+   = "{-# LANGUAGE NoImplicitPrelude #-}\n" 
        -- Dependencies on Prelude must be explicit in libraries/base, but we
-       -- don't need the Prelude here so we add -fno-implicit-prelude.
+       -- don't need the Prelude here so we add NoImplicitPrelude.
      ++ "module GHC.PrimopWrappers where\n" 
      ++ "import qualified GHC.Prim\n" 
      ++ unlines (map f (filter (not.dodgy) (filter is_primop entries)))
@@ -580,7 +577,7 @@ mkPOI_RHS_text i
                       ++ "(" ++ ppType resTy ++ ")"
 
 sl_name :: Entry -> String
-sl_name i = "FSLIT(\"" ++ name i ++ "\") "
+sl_name i = "(fsLit \"" ++ name i ++ "\") "
 
 ppTyVar :: String -> String
 ppTyVar "a" = "alphaTyVar"
@@ -603,7 +600,7 @@ ppType (TyApp "Word64#"     []) = "word64PrimTy"
 ppType (TyApp "Addr#"       []) = "addrPrimTy"
 ppType (TyApp "Float#"      []) = "floatPrimTy"
 ppType (TyApp "Double#"     []) = "doublePrimTy"
-ppType (TyApp "ByteArr#"    []) = "byteArrayPrimTy"
+ppType (TyApp "ByteArray#"  []) = "byteArrayPrimTy"
 ppType (TyApp "RealWorld"   []) = "realWorldTy"
 ppType (TyApp "ThreadId#"   []) = "threadIdPrimTy"
 ppType (TyApp "ForeignObj#" []) = "foreignObjPrimTy"
@@ -618,10 +615,10 @@ ppType (TyVar "o")               = "openAlphaTy"
 ppType (TyApp "State#" [x])      = "mkStatePrimTy " ++ ppType x
 ppType (TyApp "MutVar#" [x,y])   = "mkMutVarPrimTy " ++ ppType x 
                                    ++ " " ++ ppType y
-ppType (TyApp "MutArr#" [x,y])   = "mkMutableArrayPrimTy " ++ ppType x 
-                                   ++ " " ++ ppType y
+ppType (TyApp "MutableArray#" [x,y]) = "mkMutableArrayPrimTy " ++ ppType x
+                                    ++ " " ++ ppType y
 
-ppType (TyApp "MutByteArr#" [x]) = "mkMutableByteArrayPrimTy " 
+ppType (TyApp "MutableByteArray#" [x]) = "mkMutableByteArrayPrimTy " 
                                    ++ ppType x
 
 ppType (TyApp "Array#" [x])      = "mkArrayPrimTy " ++ ppType x