(F)SLIT -> (f)sLit in StaticFlags
[ghc-hetmet.git] / compiler / types / TyCon.lhs
index 88a6209..e6366be 100644 (file)
@@ -11,7 +11,7 @@ module TyCon(
 
        PrimRep(..),
        tyConPrimRep,
-        sizeofPrimRep,
+        primRepSizeW,
 
        AlgTyConRhs(..), visibleDataCons, 
         TyConParent(..), 
@@ -186,7 +186,7 @@ data TyCon
         tyConName   :: Name,
        tyConArity  :: Arity,
        coKindFun   :: [Type] -> (Type,Type)
-    }          -- INVARAINT: coKindFun is always applied to exactly 'arity' args
+    }          -- INVARIANT: coKindFun is always applied to exactly 'arity' args
                -- E.g. for trans (c1 :: ta=tb) (c2 :: tb=tc), the coKindFun returns 
                --      the kind as a pair of types: (ta,tc)
        
@@ -372,7 +372,7 @@ Source code:
        w2 :: Foo T
        w2 = MkFoo (\(MkT x) -> case w1 of MkFoo f -> f x)
 
-After desugaring, and discading the data constructors for the newtypes,
+After desugaring, and discarding the data constructors for the newtypes,
 we get:
        w2 :: Foo T
        w2 = w1
@@ -455,19 +455,22 @@ data PrimRep
   | AddrRep            -- a pointer, but not to a Haskell value
   | FloatRep
   | DoubleRep
-  deriving( Eq )
-
--- Size of a PrimRep, in bytes
-sizeofPrimRep :: PrimRep -> Int
-sizeofPrimRep IntRep   = wORD_SIZE
-sizeofPrimRep WordRep  = wORD_SIZE
-sizeofPrimRep Int64Rep = wORD64_SIZE
-sizeofPrimRep Word64Rep= wORD64_SIZE
-sizeofPrimRep FloatRep = 4
-sizeofPrimRep DoubleRep= 8
-sizeofPrimRep AddrRep  = wORD_SIZE
-sizeofPrimRep PtrRep   = wORD_SIZE
-sizeofPrimRep VoidRep  = 0
+  deriving( Eq, Show )
+
+instance Outputable PrimRep where
+  ppr r = text (show r)
+
+-- Size of a PrimRep, in words
+primRepSizeW :: PrimRep -> Int
+primRepSizeW IntRep   = 1
+primRepSizeW WordRep  = 1
+primRepSizeW Int64Rep = wORD64_SIZE `quot` wORD_SIZE
+primRepSizeW Word64Rep= wORD64_SIZE `quot` wORD_SIZE
+primRepSizeW FloatRep = 1    -- NB. might not take a full word
+primRepSizeW DoubleRep= dOUBLE_SIZE `quot` wORD_SIZE
+primRepSizeW AddrRep  = 1
+primRepSizeW PtrRep   = 1
+primRepSizeW VoidRep  = 0
 \end{code}
 
 %************************************************************************