[commit: ghc] ghc-generics1: recoverM was not handling the error messages and exceptions correctly in TcDeriv.mk_data_eqn's call to tcLookupClass functorClassName; switched to tryTc and it passes basic testing now (6c68a86)

José Pedro Magalhães jpm at cs.uu.nl
Fri Apr 20 18:02:40 CEST 2012


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

On branch  : ghc-generics1

http://hackage.haskell.org/trac/ghc/changeset/6c68a8611f6d8ce97a280ef3e9d1f342577d4424

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

commit 6c68a8611f6d8ce97a280ef3e9d1f342577d4424
Author: Nicolas Frisby <nicolas.frisby at gmail.com>
Date:   Tue Apr 10 11:42:35 2012 -0500

    recoverM was not handling the error messages and exceptions correctly in TcDeriv.mk_data_eqn's call to tcLookupClass functorClassName; switched to tryTc and it passes basic testing now
    
    Signed-off-by: Jose Pedro Magalhaes <jpm at cs.uu.nl>

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

 compiler/typecheck/TcDeriv.lhs |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs
index 52c1608..2071468 100644
--- a/compiler/typecheck/TcDeriv.lhs
+++ b/compiler/typecheck/TcDeriv.lhs
@@ -709,9 +709,9 @@ mk_data_eqn :: CtOrigin -> [TyVar] -> Class
 mk_data_eqn orig tvs cls tycon tc_args rep_tc rep_tc_args mtheta
   = do	{ dfun_name <- new_dfun_name cls tycon
   	; loc <- getSrcSpanM
-        -- TODO NSF 9 April 2012: only recover from a
+        -- TODO NSF 9 April 2012: only recover from the anticipated
         -- "base:Data.Functor.Functor could not be found" error
-        ; functorClass_maybe <- recoverM (return Nothing) $ Just `fmap` tcLookupClass functorClassName
+        ; (_, functorClass_maybe) <- tryTc $ tcLookupClass functorClassName
 	; let inst_tys = [mkTyConApp tycon tc_args]
 	      inferred_constraints = inferConstraints functorClass_maybe tvs cls inst_tys rep_tc rep_tc_args
 	      spec = DS { ds_loc = loc, ds_orig = orig





More information about the Cvs-ghc mailing list