[GHC] #10819: Can't generate data decls deriving multiparam type classes with TH
#10819: Can't generate data decls deriving multiparam type classes with TH -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Template | Version: 7.10.2 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- This applies to both data declarations and (more commonly) newtypes. Example: {{{ {-# LANGUAGE GeneralizedNewtypeDeriving #-} newtype T a = X { unT :: State Int a } deriving (MonadState Int) }}} The newtype declaration is impossible to express in Template Haskell's AST, as the field for the derived classes is {{{[Name]}}} when it should really be {{{Cxt}}}. A workaround is to generate a {{{StandaloneDerivD}}} for each derived multiparam class, but this requires that the user enable the {{{StandaloneDeriving}}} extension which can be unintuitive, especially as there's no way (as far as I can tell) to detect whether this extension is enabled and report a proper error message if it isn't. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10819> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10819: Can't generate data decls deriving multiparam type classes with TH -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | th/T18019.hs Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1202 -------------------------------------+------------------------------------- Changes (by spinda): * testcase: => th/T18019.hs * owner: => spinda * differential: => Phab:D1202 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10819#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10819: Can't generate data decls deriving multiparam type classes with TH -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T18019.hs Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1202 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"04ab55d9a6fe311b7cb544211738caca6c00c720/ghc" 04ab55d9/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="04ab55d9a6fe311b7cb544211738caca6c00c720" Use Cxt for deriving clauses in TH (#10819) Summary: Deriving clauses in the TH representations of data, newtype, data instance, and newtype instance declarations previously were just [Name], which didn't allow for more complex derived classes, eg. multi-parameter typeclasses. This switches out [Name] for Cxt, representing the derived classes as types instead of names. Test Plan: validate Reviewers: goldfire, spinda, austin Reviewed By: goldfire, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1202 GHC Trac Issues: #10819 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10819#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10819: Can't generate data decls deriving multiparam type classes with TH -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T18019.hs Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1202 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10819#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC