X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypes%2FType.lhs;h=c7e5fa250901254842eab866d7a2e7d0edde5851;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=bb3c67067a0667841d884cf700a1f473083e67c8;hpb=553e90d9a32ee1b1809430f260c401cc4169c6c7;p=ghc-hetmet.git diff --git a/ghc/compiler/types/Type.lhs b/ghc/compiler/types/Type.lhs index bb3c670..c7e5fa2 100644 --- a/ghc/compiler/types/Type.lhs +++ b/ghc/compiler/types/Type.lhs @@ -12,6 +12,8 @@ module Type ( -- Re-exports from Kind module Kind, + -- Re-exports from TyCon + PrimRep(..), mkTyVarTy, mkTyVarTys, getTyVar, getTyVar_maybe, isTyVarTy, @@ -86,14 +88,12 @@ import TyCon ( TyCon, isRecursiveTyCon, isPrimTyCon, isUnboxedTupleTyCon, isUnLiftedTyCon, isFunTyCon, isNewTyCon, newTyConRep, newTyConRhs, isAlgTyCon, isSynTyCon, tyConArity, - tyConKind, getSynTyConDefn, - tyConPrimRep, + tyConKind, getSynTyConDefn, PrimRep(..), tyConPrimRep, ) -- others import CmdLineOpts ( opt_DictsStrict ) import SrcLoc ( noSrcLoc ) -import PrimRep ( PrimRep(..) ) import Unique ( Uniquable(..) ) import Util ( mapAccumL, seqList, lengthIs, snocView ) import Outputable @@ -391,13 +391,20 @@ repType (NewTcApp tc tys) = ASSERT( tys `lengthIs` tyConArity tc ) repType ty = ty +-- ToDo: this could be moved to the code generator, using splitTyConApp instead +-- of inspecting the type directly. typePrimRep :: Type -> PrimRep typePrimRep ty = case repType ty of TyConApp tc _ -> tyConPrimRep tc FunTy _ _ -> PtrRep - AppTy _ _ -> PtrRep -- ?? + AppTy _ _ -> PtrRep -- See note below TyVarTy _ -> PtrRep other -> pprPanic "typePrimRep" (ppr ty) + -- Types of the form 'f a' must be of kind *, not *#, so + -- we are guaranteed that they are represented by pointers. + -- The reason is that f must have kind *->*, not *->*#, because + -- (we claim) there is no way to constrain f's kind any other + -- way. -- new_type_rep doesn't ask any questions: -- it just expands newtype, whether recursive or not @@ -407,7 +414,6 @@ new_type_rep new_tycon tys = ASSERT( tys `lengthIs` tyConArity new_tycon ) \end{code} - --------------------------------------------------------------------- ForAllTy ~~~~~~~~