[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

#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