Move snocView in the file, nearer the other spliting functions
[ghc-hetmet.git] / compiler / types / Type.lhs
index a7aeeec..0d7767b 100644 (file)
@@ -117,11 +117,12 @@ import PrelNames( openTypeKindTyConKey, unliftedTypeKindTyConKey,
                   ubxTupleKindTyConKey, argTypeKindTyConKey )
 import TyCon   ( TyCon, isRecursiveTyCon, isPrimTyCon,
                  isUnboxedTupleTyCon, isUnLiftedTyCon,
-                 isFunTyCon, isNewTyCon, newTyConRep, newTyConRhs,
+                 isFunTyCon, isNewTyCon, isClosedNewTyCon, 
+                 newTyConRep, newTyConRhs, 
                  isAlgTyCon, tyConArity, isSuperKindTyCon,
                  tcExpandTyCon_maybe, coreExpandTyCon_maybe,
                  tyConKind, PrimRep(..), tyConPrimRep, tyConUnique,
-                  isCoercionTyCon_maybe, isCoercionTyCon
+                  isCoercionTyCon
                )
 
 -- others
@@ -448,7 +449,7 @@ repType looks through
        (b) synonyms
        (c) predicates
        (d) usage annotations
-       (e) all newtypes, including recursive ones
+       (e) all newtypes, including recursive ones, but not newtype families
 It's useful in the back end.
 
 \begin{code}
@@ -457,7 +458,7 @@ repType :: Type -> Type
 repType ty | Just ty' <- coreView ty = repType ty'
 repType (ForAllTy _ ty)  = repType ty
 repType (TyConApp tc tys)
-  | isNewTyCon tc       = -- Recursive newtypes are opaque to coreView
+  | isClosedNewTyCon tc  = -- Recursive newtypes are opaque to coreView
                           -- but we must expand them here.  Sure to
                           -- be saturated because repType is only applied
                           -- to types of kind *
@@ -616,7 +617,7 @@ splitRecNewType_maybe :: Type -> Maybe Type
 -- Only applied to types of kind *, hence the newtype is always saturated
 splitRecNewType_maybe ty | Just ty' <- coreView ty = splitRecNewType_maybe ty'
 splitRecNewType_maybe (TyConApp tc tys)
-  | isNewTyCon tc
+  | isClosedNewTyCon tc
   = ASSERT( tys `lengthIs` tyConArity tc )     -- splitRecNewType_maybe only be applied 
                                                --      to *types* (of kind *)
     ASSERT( isRecursiveTyCon tc )              -- Guaranteed by coreView