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

On branch  : ghc-7.6

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

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

commit 6ccf78e15a525282fef61bc4f58a279aa9c21771
Author: David Waern <david.wa...@gmail.com>
Date:   Fri Sep 28 19:50:20 2012 +0200

    Fix spurious superclass constraints bug.

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

 src/Haddock/Interface/AttachInstances.hs |   31 ++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/Haddock/Interface/AttachInstances.hs 
b/src/Haddock/Interface/AttachInstances.hs
index ebe62cb..4b5f159 100644
--- a/src/Haddock/Interface/AttachInstances.hs
+++ b/src/Haddock/Interface/AttachInstances.hs
@@ -22,19 +22,20 @@ import Data.List
 import qualified Data.Map as Map
 import qualified Data.Set as Set
 
-import GHC
-import Name
-import InstEnv
 import Class
+import FastString
+import GHC
 import GhcMonad (withSession)
-import TysPrim( funTyCon )
+import Id
+import InstEnv
 import MonadUtils (liftIO)
+import Name
+import PrelNames
 import TcRnDriver (tcRnGetInfo)
+import TyCon
 import TypeRep
+import TysPrim( funTyCon )
 import Var hiding (varName)
-import TyCon
-import PrelNames
-import FastString
 #define FSLIT(x) (mkFastString# (x#))
 
 type ExportedNames = Set.Set Name
@@ -65,7 +66,7 @@ attachToExportItem expInfo iface ifaceMap instIfaceMap export 
=
                   Just (_, _, instances) ->
                     let insts = map (first synifyInstHead) $ sortImage (first 
instHead) $
                                 filter (\((_,_,cls,tys),_) -> not $ 
isInstanceHidden expInfo cls tys)
-                                [ (instanceHead i, getName i) | i <- instances 
]
+                                [ (instanceHead' i, getName i) | i <- 
instances ]
                     in [ (inst, lookupInstDoc name iface ifaceMap instIfaceMap)
                        | (inst, name) <- insts ]
                   Nothing -> []
@@ -94,6 +95,20 @@ lookupInstDoc name iface ifaceMap instIfaceMap =
     modName = nameModule name
 
 
+-- | Like GHC's 'instanceHead' but drops "silent" arguments.
+instanceHead' :: ClsInst -> ([TyVar], ThetaType, Class, [Type])
+instanceHead' ispec = (tvs, dropSilentArgs dfun theta, cls, tys)
+  where
+    dfun = is_dfun ispec
+    (tvs, theta, cls, tys) = instanceHead ispec
+
+
+-- | Drop "silent" arguments. See GHC Note [Silent superclass
+-- arguments].
+dropSilentArgs :: DFunId -> ThetaType -> ThetaType
+dropSilentArgs dfun theta = drop (dfunNSilent dfun) theta
+
+
 -- | Like GHC's getInfo but doesn't cut things out depending on the
 -- interative context, which we don't set sufficiently anyway.
 getAllInfo :: GhcMonad m => Name -> m (Maybe (TyThing,Fixity,[ClsInst]))



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to