[GHC] #12519: Rendered Haddock for Eq and Ord are missing class methods
#12519: Rendered Haddock for Eq and Ord are missing class methods -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Documentation | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Documentation Unknown/Multiple | bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The rendered haddock for the {{{Eq}}} and {{{Ord}}} classes are missing: * Their class methods * Their source links See: * http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Eq.html#t:Eq * http://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Eq * http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Ord.html#t:Ord * http://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Ord Other (deriviable) classes, for example {{{Show}}}, or {{{Enum}}}, do not have these problems. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12519: Rendered Haddock for Eq and Ord are missing class methods -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Documentation | Version: 8.0.1 Resolution: | Keywords: 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 darchon): I've also reported it as a haddock issue: https://github.com/haskell/haddock/issues/549 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12519: Rendered Haddock for Eq and Ord are missing class methods -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: bug | Status: new Priority: normal | 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: | -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => newcomer -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: normal => high Comment: Wow, this is quite bizarre. Someone will need to work out what is going on here. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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): I took a look and it looks like `haddock`'s `ppClassDecl` gets: {{{ Enum MinimalSig ClassOpSig [succ] ClassOpSig [pred] ClassOpSig [toEnum] ClassOpSig [fromEnum] ClassOpSig [enumFrom] ClassOpSig [enumFromThen] ClassOpSig [enumFromTo] ClassOpSig [enumFromThenTo] }}} for `Enum`, but {{{ Eq MinimalSig TypeSig [==] TypeSig [/=] }}} for `Eq`. So we either want to: 1. handle `TypeSig` in `haddock`, or 2. always return `ClassOpSig` for typeclass methods I believe 2. is preferable. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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): To give an update on this: * Haddock gets the right data from GHC (at least the first time) * The data appears to get mangled only when Haddock saves it to an interface file and then reads it in a different invocation -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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/3fd2ed3213778c090ed5e27bd8a9e5bdee... 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
#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 Matthew Pickering <matthewtpickering@…>): In [changeset:"6886bba8ea2965177c00edceb98509b48957b515/ghc" 6886bba/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="6886bba8ea2965177c00edceb98509b48957b515" Bump Haddock submodule to fix rendering of class methods Fixes #12519 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12519: Rendered Haddock for Eq and Ord are missing class methods -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: bug | Status: merge 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: | -------------------------------------+------------------------------------- Changes (by mpickering): * status: new => merge Comment: The patch works as advertised. Thanks Bartosz! I merged this into the `ghc-head` branch and updated the submodule on the GHC master branch. Ben, I think that just leaves cherry-picking the appropriate commits onto the 8.0 branch(s). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12519: Rendered Haddock for Eq and Ord are missing class methods -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Documentation | Version: 8.0.1 Resolution: fixed | 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Bumped in 46dc8854b4ff2a8f1a9ca9aa2d0a8271d5bc4ff6. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12519#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC