Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : imp-param-class

http://hackage.haskell.org/trac/ghc/changeset/a9ea1fe7cae8760e75e128da4f2589309fea9bec

>---------------------------------------------------------------

commit a9ea1fe7cae8760e75e128da4f2589309fea9bec
Author: Iavor S. Diatchki <[email protected]>
Date:   Thu May 24 14:34:15 2012 -0700

    We turn implicit parameters into uses of the IP class method.

>---------------------------------------------------------------

 compiler/typecheck/TcExpr.lhs |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcExpr.lhs b/compiler/typecheck/TcExpr.lhs
index 488e654..3fae6a2 100644
--- a/compiler/typecheck/TcExpr.lhs
+++ b/compiler/typecheck/TcExpr.lhs
@@ -185,8 +185,16 @@ tcExpr (HsIPVar ip) res_ty
                -- type variable as its type.  (Because res_ty may not
                -- be a tau-type.)
        ; ip_ty <- newFlexiTyVarTy argTypeKind  -- argTypeKind: it can't be an 
unboxed tuple
-       ; ip_var <- emitWanted origin (mkIPPred ip ip_ty)
-       ; tcWrapResult (HsIPVar (IPName ip_var)) ip_ty res_ty }
+        -- XXX: Change HsIPVar to just keep the string around.
+        ; let param = mkStrLitTy $ occNameFS $ nameOccName $ ipNameName ip
+        ; ipClass <- tcLookupClass ipClassName
+        ; ipVal   <- tcLookupId ipClassOpName
+       ; ip_var <- emitWanted origin (mkClassPred ipClass [param,ip_ty])
+        ; let expr = mkHsWrap (WpEvApp (EvId ip_var))
+                   $ mkHsWrap (WpTyApp ip_ty)
+                   $ mkHsWrap (WpTyApp param)
+                   $ HsVar ipVal
+       ; tcWrapResult expr ip_ty res_ty }
 
 tcExpr (HsLam match) res_ty
   = do { (co_fn, match') <- tcMatchLambda match res_ty



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to