[GHC] #15178: Implement DerivingVia
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Keywords: deriving | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The `DerivingVia` GHC proposal [https://github.com/ghc-proposals/ghc- proposals/pull/120 has been accepted]. This ticket serves as a reminder to get the corresponding patch into GHC. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4684 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * owner: (none) => RyanGlScott * differential: => Phab:D4684 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: feature request | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4684 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: feature request | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: deriving, | GHCProposal Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4684 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: deriving => deriving, GHCProposal -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: feature request | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: deriving, | GHCProposal Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4684 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"8ed8b037fee9611b1c4ef49adb6cf50bbd929a27/ghc" 8ed8b03/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="8ed8b037fee9611b1c4ef49adb6cf50bbd929a27" Introduce DerivingVia This implements the `DerivingVia` proposal put forth in https://github.com/ghc-proposals/ghc-proposals/pull/120. This introduces the `DerivingVia` deriving strategy. This is a generalization of `GeneralizedNewtypeDeriving` that permits the user to specify the type to `coerce` from. The major change in this patch is the introduction of the `ViaStrategy` constructor to `DerivStrategy`, which takes a type as a field. As a result, `DerivStrategy` is no longer a simple enumeration type, but rather something that must be renamed and typechecked. The process by which this is done is explained more thoroughly in section 3 of this paper ( https://www.kosmikus.org/DerivingVia/deriving-via-paper.pdf ), although I have inlined the relevant parts into Notes where possible. There are some knock-on changes as well. I took the opportunity to do some refactoring of code in `TcDeriv`, especially the `mkNewTypeEqn` function, since it was bundling all of the logic for (1) deriving instances for newtypes and (2) `GeneralizedNewtypeDeriving` into one huge broth. `DerivingVia` reuses much of part (2), so that was factored out as much as possible. Bumps the Haddock submodule. Test Plan: ./validate Reviewers: simonpj, bgamari, goldfire, alanz Subscribers: alanz, goldfire, rwbarton, thomie, mpickering, carter GHC Trac Issues: #15178 Differential Revision: https://phabricator.haskell.org/D4684 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15178: Implement DerivingVia -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: feature request | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: deriving, | GHCProposal Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_fail/deriving-via- | fail{,2,3,4}, | deriving/should_compile/deriving- | via-compile, | deriving/should_compile/deriving- | via-standalone Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4684 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => deriving/should_fail/deriving-via-fail{,2,3,4}, deriving/should_compile/deriving-via-compile, deriving/should_compile /deriving-via-standalone * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15178#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC