Flip direction of newtype coercions, fix some comments
[ghc-hetmet.git] / compiler / coreSyn / CoreSyn.lhs
index f83845f..3db1a33 100644 (file)
@@ -50,11 +50,13 @@ import StaticFlags  ( opt_RuntimeTypes )
 import CostCentre      ( CostCentre, noCostCentre )
 import Var             ( Var, Id, TyVar, isTyVar, isId )
 import Type            ( Type, mkTyVarTy, seqType )
+import TyCon            ( isNewTyCon )
 import Coercion         ( Coercion )
 import Name            ( Name )
 import OccName         ( OccName )
 import Literal         ( Literal, mkMachInt )
-import DataCon         ( DataCon, dataConWorkId, dataConTag )
+import DataCon         ( DataCon, dataConWorkId, dataConTag, dataConTyCon,
+                          dataConWrapId )
 import BasicTypes      ( Activation )
 import FastString
 import Outputable
@@ -112,7 +114,8 @@ type Arg b = Expr b         -- Can be a Type
 
 type Alt b = (AltCon, [b], Expr b)     -- (DEFAULT, [], rhs) is the default alternative
 
-data AltCon = DataAlt DataCon
+data AltCon = DataAlt DataCon  -- Invariant: the DataCon is always from 
+                               -- a *data* type, and never from a *newtype*
            | LitAlt  Literal
            | DEFAULT
         deriving (Eq, Ord)
@@ -439,7 +442,7 @@ mkLets            :: [Bind b] -> Expr b -> Expr b
 mkLams       :: [b] -> Expr b -> Expr b
 
 mkLit lit        = Lit lit
-mkConApp con args = pprTrace "mkConApp" (ppr con) $ mkApps (Var (dataConWorkId con)) args
+mkConApp con args = mkApps (Var (dataConWorkId con)) args
 
 mkLams binders body = foldr Lam body binders
 mkLets binds body   = foldr Let body binds