#include "HsVersions.h"
-- friends
-import NDPCoreUtils (tupleTyArgs, funTyArgs, parrElemTy, isDefault,
+import NDPCoreUtils (tupleTyArgs, funTyArgs, isDefault,
isLit, mkPArrTy, mkTuple, isSimpleExpr, substIdEnv)
import FlattenMonad (Flatten, runFlatten, mkBind, extendContext, packContext,
liftVar, liftConst, intersectWithContext, mk'fst,
- mk'lengthP, mk'replicateP, mk'mapP, mk'bpermuteDftP,
- mk'indexOfP,mk'eq,mk'neq)
+ mk'mapP, mk'bpermuteDftP, mk'indexOfP,mk'eq,mk'neq)
-- GHC
import TcType ( tcIsForAllTy, tcView )
import TypeRep ( Type(..) )
+import Coercion ( coercionKind )
import StaticFlags (opt_Flatten)
import Panic (panic)
import ErrUtils (dumpIfSet_dyn)
import Var (Var(..), idType, isTyVar)
import Id (setIdType)
import DataCon (DataCon, dataConTag)
-import HscTypes ( ModGuts(..), ModGuts, HscEnv(..), hscEPS )
+import HscTypes ( ModGuts(..), HscEnv(..), hscEPS )
import CoreFVs (exprFreeVars)
-import CoreSyn (Expr(..), Bind(..), Alt(..), AltCon(..), Note(..),
+import CoreSyn (Expr(..), Bind(..), Alt, AltCon(..),
CoreBndr, CoreExpr, CoreBind, mkLams, mkLets,
mkApps, mkIntLitInt)
import PprCore (pprCoreExpr)
import Outputable
import FastString
-
--- FIXME: fro debugging - remove this
-import TRACE (trace)
-
-- standard
import Monad (liftM, foldM)
else extendContext [lb] (liftCaseDataCon b alts)
letWrapper lExpr b lalts
-lift (Note (Coerce t1 t2) expr) =
- do
+lift (Cast expr co) =
+ do
(lexpr, t) <- lift expr
- let lt1 = liftTy t1
- return ((Note (Coerce lt1 (liftTy t2)) lexpr), lt1)
+ let lco = liftTy co
+ let (t1, t2) = coercionKind lco
+ return ((Cast expr lco), t2)
lift (Note note expr) =
do