X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FndpFlatten%2FFlattening.hs;h=220c571e1e4dcb7b9a892cd2ac2b6fe91cf53042;hb=58de6cb725982dd1f57803cc838f233d5fd9c42c;hp=18daaa632395071d485396e8d28cc7749e9ed9c8;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/ndpFlatten/Flattening.hs b/compiler/ndpFlatten/Flattening.hs index 18daaa6..220c571 100644 --- a/compiler/ndpFlatten/Flattening.hs +++ b/compiler/ndpFlatten/Flattening.hs @@ -1,3 +1,10 @@ +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + -- $Id$ -- -- Copyright (c) [2001..2002] Manuel M T Chakravarty & Gabriele Keller @@ -55,16 +62,16 @@ module Flattening ( #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) @@ -74,9 +81,9 @@ import Literal (Literal, literalType) 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) @@ -89,10 +96,6 @@ import BasicTypes (Boxity(..)) import Outputable import FastString - --- FIXME: fro debugging - remove this -import TRACE (trace) - -- standard import Monad (liftM, foldM) @@ -448,11 +451,12 @@ lift cExpr@(Case expr b _ alts) = 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