[GHC] #12519: Rendered Haddock for Eq and Ord are missing class methods

GHC ghc-devs at haskell.org
Tue Sep 20 14:39:31 UTC 2016


#12519: Rendered Haddock for Eq and Ord are missing class methods
-------------------------------------+-------------------------------------
        Reporter:  darchon           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.2
       Component:  Documentation     |              Version:  8.0.1
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Documentation     |  Unknown/Multiple
  bug                                |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by niteria):

 Ok, I know what happened here, but my poor internet connection prevents me
 from committing.

 https://github.com/haskell/haddock/commit/3fd2ed3213778c090ed5e27bd8a9e5bdee5c5135
 fixed Haddock after `wildcard-refactor`, but missed a (non-obvious) spot.

 The relevant part is in `ppClassDecl` where `TypeSig` was changed to
 `ClassOpSig` to accommodate GHC changes. And it works when Haddock uses
 GHC API to get type information.

 Unfortunately there's another way Haddock can get the information and
 that's using an interface file. There's some logic in `Haddock/Convert.hs`
 to deal with that, the relevant function is `tyThingToLHsDecl`. That's
 where Haddock will choose to use `TypeSig` for a type signature of a
 typeclass method.

 Here is a patch that fixes this:
 {{{
 diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-
 api/src/Haddock/Convert.hs
 index 88cedc7..41e98c6 100644
 --- a/haddock-api/src/Haddock/Convert.hs
 +++ b/haddock-api/src/Haddock/Convert.hs
 @@ -81,7 +81,7 @@ tyThingToLHsDecl t = case t of
                          (map (noLoc . getName) l, map (noLoc . getName)
 r) ) $
                           snd $ classTvsFds cl
           , tcdSigs = noLoc (MinimalSig mempty . noLoc . fmap noLoc $
 classMinimalDef cl) :
 -                      map (noLoc . synifyIdSig
 DeleteTopLevelQuantification)
 +                      map (noLoc . synifyTcIdSig
 DeleteTopLevelQuantification)
                          (classMethods cl)
           , tcdMeths = emptyBag --ignore default method definitions, they
 don't affect signature
           -- class associated-types are a subset of TyCon:
 @@ -316,6 +316,8 @@ synifyName = noLoc . getName
  synifyIdSig :: SynifyTypeState -> Id -> Sig Name
  synifyIdSig s i = TypeSig [synifyName i] (synifySigWcType s (varType i))

 +synifyTcIdSig :: SynifyTypeState -> Id -> Sig Name
 +synifyTcIdSig s i = ClassOpSig False [synifyName i] (synifySigType s
 (varType i))

  synifyCtx :: [PredType] -> LHsContext Name
  synifyCtx = noLoc . map (synifyType WithinType)
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list