[commit: ghc] master: Simplify and improve coverage of ":info" instance lookup (eb8fb43)
git at git.haskell.org
git at git.haskell.org
Fri Nov 15 00:39:36 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/eb8fb434ff5e962a54247cacc5d3340972d5daf4/ghc
>---------------------------------------------------------------
commit eb8fb434ff5e962a54247cacc5d3340972d5daf4
Author: Patrick Palka <patrick at parcs.ath.cx>
Date: Thu Nov 14 17:40:55 2013 -0500
Simplify and improve coverage of ":info" instance lookup
During instance lookup, we can treat classes and data families like any
other TyCon instead of special-casing them. This approach, aside from
being simpler, has the benefit of returning extra relevant instances for
classes and data families. For example, given
class A a
instance B (a :: Constraint)
instance A B
":info B" will now also print "instance A B" where previously it didn't
due to the special casing of class TyCons in lookupInsts.
This improves upon the existing patch for Trac #4175
>---------------------------------------------------------------
eb8fb434ff5e962a54247cacc5d3340972d5daf4
compiler/typecheck/TcRnDriver.lhs | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index 594d7fd..16b399b 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -2055,15 +2055,6 @@ tcRnGetInfo hsc_env name
lookupInsts :: TyThing -> TcM ([ClsInst],[FamInst])
lookupInsts (ATyCon tc)
- | Just cls <- tyConClass_maybe tc
- = do { inst_envs <- tcGetInstEnvs
- ; return (classInstances inst_envs cls, []) }
-
- | isOpenFamilyTyCon tc || isTyConAssoc tc
- = do { inst_envs <- tcGetFamInstEnvs
- ; return ([], familyInstances inst_envs tc) }
-
- | otherwise
= do { (pkg_ie, home_ie) <- tcGetInstEnvs
; (pkg_fie, home_fie) <- tcGetFamInstEnvs
-- Load all instances for all classes that are
More information about the ghc-commits
mailing list