Commit 56f88d58 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Fix some inconsistencies in the code and docs of primitives

We were inconsistent about whether to use the name "MutArr#" or
"MutableArray#". Likewise ByteArr#/ByteArray# and
MutByteArr#/MutableByteArray#.
parent 9a657491
This diff is collapsed.
......@@ -17,9 +17,9 @@ primTcs = [
(zEncodeString "Double#", Kunlifted),
(zEncodeString "Float#", Kunlifted),
(zEncodeString "Array#", (Karrow Klifted Kunlifted)),
(zEncodeString "MutArr#", (Karrow Klifted (Karrow Klifted Kunlifted))),
(zEncodeString "ByteArr#", Kunlifted),
(zEncodeString "MutByteArr#", (Karrow Klifted Kunlifted)),
(zEncodeString "MutableArray#", (Karrow Klifted (Karrow Klifted Kunlifted))),
(zEncodeString "ByteArray#", Kunlifted),
(zEncodeString "MutableByteArray#", (Karrow Klifted Kunlifted)),
(zEncodeString "Addr#", Kunlifted),
(zEncodeString "MutVar#", (Karrow Klifted (Karrow Klifted Kunlifted))),
(zEncodeString "TVar#", (Karrow Klifted (Karrow Klifted Kunlifted))),
......
......@@ -18,14 +18,7 @@ initialEnv = efromlist [(primMname,primEnv),
(errMname,errorEnv)]
primEnv :: Envs
-- Tediously, we add defs for ByteArray# etc. because these are
-- declared as ByteArr# (etc.) in primops.txt, and GHC has
-- ByteArray# etc. wired-in.
-- At least this is better than when all primops were wired-in here.
primEnv = Envs {tcenv_=efromlist $ map (\ (t,k) -> (t,Kind k)) $
[(snd tcByteArrayzh,ktByteArrayzh),
(snd tcMutableArrayzh, ktMutableArrayzh),
(snd tcMutableByteArrayzh, ktMutableByteArrayzh)] ++
primEnv = Envs {tcenv_=efromlist $ map (\ (t,k) -> (t,Kind k))
([(snd $ tcUtuple n, ktUtuple n) | n <- [1..maxUtuple]]
++ ((snd tcArrow,ktArrow):primTcs)),
cenv_=efromlist primDcs,
......@@ -54,20 +47,6 @@ opsState :: [(Var, Ty)]
opsState = [
("realWorldzh", tRWS)]
{- Arrays -}
tcByteArrayzh, tcMutableArrayzh, tcMutableByteArrayzh :: Qual Tcon
ktByteArrayzh, ktMutableArrayzh, ktMutableByteArrayzh :: Kind
tcByteArrayzh = pvz "ByteArray"
ktByteArrayzh = Kunlifted
tcMutableArrayzh = pvz "MutableArray"
ktMutableArrayzh = Karrow Klifted (Karrow Klifted Kunlifted)
tcMutableByteArrayzh = pvz "MutableByteArray"
ktMutableByteArrayzh = Karrow Klifted Kunlifted
{- Real world and state. -}
-- tjc: why isn't this one unboxed?
......
......@@ -279,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" ++ ", "
......@@ -604,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"
......@@ -619,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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment