[GHC] #13175: Documenting what can be derived 'out of the box' by GHC's "deriving"

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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: -------------------------------------+------------------------------------- Nowhere in the documentation is it clearly stated which classes can be derived (assuming extensions as necessary) by GHC's "deriving" mechanism. As determined by reading the sources, this appears to be - Bounded, Enum, Eq, Ix, Ord, Read, Show, Functor, Foldable, Traversable, Generic, Generic1, Data, Lift. This was discussed on haskell-cafe -- see https://mail.haskell.org/pipermail/haskell-cafe/2016-October/125379.html. PS: I would be willing to fix this myself, if only I knew *where* to insert that information so that it is easily ''findable''! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 simonpj):
PS: I would be willing to fix this myself, if only I knew *where* to insert that information so that it is easily findable!
Thank you! But you are the best person to say where you'd expect to find it, because presumably you looked :-). I'd love a patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 carette): Unfortunately I 'looked' via Google. I expected to find it that way... Once the information is somewhere, I will then expect that that will indeed work. But, in the meantime, I am still at a loss as to where to put it. One of the problems is that when you search for "GHC" and "deriving", the principal hits are to section 7.5 of the manual (https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/deriving.html) which documents the extensions to this mechanism. If you dig really (really!) hard, you eventually find section 4.3.3 of the Haskell 98 report (https://www.haskell.org/onlinereport/decls.html#derived-decls) which documents "deriving" (the 2010 report's 4.3.3 is essentially identical). But Google doesn't seem to like that much, so it doesn't show up. But the list in those reports is not the same as the list above! So I am still at a loss as to where to put this. GHC's own documentation does not define "deriving" (because the Haskell reports already do), which would have been my first thought. So maybe in 7.5 somewhere? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 RyanGlScott): Thank you for the report. So you're correct in that the list of //stock// derivable classes is not so Google-able (where `stock` is terminology that I use in the upcoming `DerivingStrategies` GHC extension, documented [https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/DerivingStrategies here]). That `DerivingStrategies` wiki page information does need to be in a more public location, I admit. The users' guide actually //does// list all of the stock derivable classes that are available via GHC extensions in http://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.h... #deriving-instances-of-extra-classes-data-etc. But we don't currently list the stock derivable classes that were already mentioned in the Haskell Report (`Bounded`, `Enum`, `Ix`, `Eq`, `Ord`, `Read`, and `Show`). If I recapped those classes in that section of the users' guide, would that work for you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 carette): The `DerivingStrategies` web page is actually easier to find (I referenced it when I first asked the question https://mail.haskell.org/pipermail /haskell-cafe/2016-October/125378.html). Yes, recapping the stock derivable instances along with the extras that GHC also implements would work for me. Perhaps in the prelude to 9.6 (i.e. before 9.6.1)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 RyanGlScott): That sounds agreeable to me! Do you want to take a crack at fixing the users' guide? The relevant part of the codebase that you'd have to change is here: http://git.haskell.org/ghc.git/blob/9fd87ef8a16fbbce35205ae63d75d239bb575ccc... And if you want to preview what your changes look like, you can either build just the docs (see [https://ghc.haskell.org/trac/ghc/wiki/Building/Docs#UsersGuide these instructions]), or you can fork GHC on GitHub and view a rendered version of `docs/users_guide/glasgow_exts.rst` directly (for example, see [https://github.com/ghc/ghc/blob/master/docs/users_guide/glasgow_exts.rst this]). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 carette): Yes, I'll give it a crack. Does this mean that I should 'own' this ticket? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: Type: task | Status: new Priority: normal | Milestone: 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 RyanGlScott): Replying to [comment:6 carette]:
Yes, I'll give it a crack. Does this mean that I should 'own' this ticket?
Sure, go ahead. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 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 RyanGlScott): * keywords: => newcomer -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: (none) Type: task | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.0.1 Resolution: | Keywords: newcomer, | deriving 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 RyanGlScott): * keywords: newcomer => newcomer, deriving -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13175: Documenting what can be derived 'out of the box' by GHC's "deriving" -------------------------------------+------------------------------------- Reporter: carette | Owner: (none) Type: task | Status: closed Priority: normal | Milestone: 8.4.1 Component: Documentation | Version: 8.0.1 Resolution: fixed | Keywords: newcomer, | deriving 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 RyanGlScott): * status: new => closed * resolution: => fixed * milestone: => 8.4.1 Comment: I believe this can be considered fixed as of 317aa966b3d89e45227a5870feba339e34d77a18. The [http://git.haskell.org/ghc.git/blob/317aa966b3d89e45227a5870feba339e34d77a18... beginning of the users' guide section] on GHC's extensions to `deriving` now mentions: {{{ * In Haskell 98, the only derivable classes are ``Eq``, ``Ord``, ``Enum``, ``Ix``, ``Bounded``, ``Read``, and ``Show``. `Various langauge extensions <#deriving-extra>`__ extend this list. }}} The `deriving-extra` section then proceeds to mention each of the remaining classes that are stock derivable. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13175#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC