Massive patch for the first months work adding System FC to GHC #25
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>
Fri, 4 Aug 2006 22:05:26 +0000 (22:05 +0000)
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>
Fri, 4 Aug 2006 22:05:26 +0000 (22:05 +0000)
Broken up massive patch -=chak
Original log message:
This is (sadly) all done in one patch to avoid Darcs bugs.
It's not complete work... more FC stuff to come.  A compiler
using just this patch will fail dismally.

compiler/ndpFlatten/Flattening.hs
compiler/ndpFlatten/NDPCoreUtils.hs
compiler/ndpFlatten/PArrAnal.hs

index 18daaa6..c339c76 100644 (file)
@@ -65,6 +65,7 @@ import FlattenMonad (Flatten, runFlatten, mkBind, extendContext, packContext,
 -- GHC
 import TcType      ( tcIsForAllTy, tcView )
 import TypeRep     ( Type(..) )
+import Coercion     ( coercionKind )
 import StaticFlags  (opt_Flatten)
 import Panic        (panic)
 import ErrUtils     (dumpIfSet_dyn)
@@ -448,11 +449,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 
index 6e6b94f..9fdca34 100644 (file)
@@ -171,4 +171,5 @@ substIdEnv env (Case expr b ty alts) =
        (c, bnds, substIdEnv (delVarEnvList env bnds) expr)
 substIdEnv env (Note n expr) =
   Note n (substIdEnv env expr)
+substIdEnv env (Cast e co) = Cast (substIdEnv env e) co
 substIdEnv env e@(Type t) = e
index 2db5622..804162c 100644 (file)
@@ -87,6 +87,10 @@ arrUsage (Note n expr) =
 arrUsage (Type t) =
   typeArrayUsage  t
 
+-- not quite sure this is right
+arrUsage (Cast expr co) =
+  arrUsage expr 
+
 bindType (b, expr) =
   let
     bT    = varArrayUsage b