Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix spurious superclass constraints bug.

  • Loading branch information...
commit 6ccf78e15a525282fef61bc4f58a279aa9c21771 1 parent d40f783
David Waern waern authored

Showing 1 changed file with 23 additions and 8 deletions. Show diff stats Hide diff stats

  1. +23 8 src/Haddock/Interface/AttachInstances.hs
31 src/Haddock/Interface/AttachInstances.hs
@@ -22,19 +22,20 @@ import Data.List
22 22 import qualified Data.Map as Map
23 23 import qualified Data.Set as Set
24 24
25   -import GHC
26   -import Name
27   -import InstEnv
28 25 import Class
  26 +import FastString
  27 +import GHC
29 28 import GhcMonad (withSession)
30   -import TysPrim( funTyCon )
  29 +import Id
  30 +import InstEnv
31 31 import MonadUtils (liftIO)
  32 +import Name
  33 +import PrelNames
32 34 import TcRnDriver (tcRnGetInfo)
  35 +import TyCon
33 36 import TypeRep
  37 +import TysPrim( funTyCon )
34 38 import Var hiding (varName)
35   -import TyCon
36   -import PrelNames
37   -import FastString
38 39 #define FSLIT(x) (mkFastString# (x#))
39 40
40 41 type ExportedNames = Set.Set Name
@@ -65,7 +66,7 @@ attachToExportItem expInfo iface ifaceMap instIfaceMap export =
65 66 Just (_, _, instances) ->
66 67 let insts = map (first synifyInstHead) $ sortImage (first instHead) $
67 68 filter (\((_,_,cls,tys),_) -> not $ isInstanceHidden expInfo cls tys)
68   - [ (instanceHead i, getName i) | i <- instances ]
  69 + [ (instanceHead' i, getName i) | i <- instances ]
69 70 in [ (inst, lookupInstDoc name iface ifaceMap instIfaceMap)
70 71 | (inst, name) <- insts ]
71 72 Nothing -> []
@@ -94,6 +95,20 @@ lookupInstDoc name iface ifaceMap instIfaceMap =
94 95 modName = nameModule name
95 96
96 97
  98 +-- | Like GHC's 'instanceHead' but drops "silent" arguments.
  99 +instanceHead' :: ClsInst -> ([TyVar], ThetaType, Class, [Type])
  100 +instanceHead' ispec = (tvs, dropSilentArgs dfun theta, cls, tys)
  101 + where
  102 + dfun = is_dfun ispec
  103 + (tvs, theta, cls, tys) = instanceHead ispec
  104 +
  105 +
  106 +-- | Drop "silent" arguments. See GHC Note [Silent superclass
  107 +-- arguments].
  108 +dropSilentArgs :: DFunId -> ThetaType -> ThetaType
  109 +dropSilentArgs dfun theta = drop (dfunNSilent dfun) theta
  110 +
  111 +
97 112 -- | Like GHC's getInfo but doesn't cut things out depending on the
98 113 -- interative context, which we don't set sufficiently anyway.
99 114 getAllInfo :: GhcMonad m => Name -> m (Maybe (TyThing,Fixity,[ClsInst]))

0 comments on commit 6ccf78e

Please sign in to comment.
Something went wrong with that request. Please try again.