[GHC] #9761: A module can't usefully use both GeneralizedNewtypeDeriving and DeriveFoldable

#9761: A module can't usefully use both GeneralizedNewtypeDeriving and DeriveFoldable -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: GHC Blocked By: | rejects valid program Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- If GND is enabled, and roles don't permit a `Foldable` instance to be derived, it won't fall back on `DeriveFoldable`; instead it just produces an error. I think ideally I'd want to use a pragma to state explicitly that I want to use `DeriveFoldable`-style deriving for this specific instance, but an implicit fallback would be acceptable. {{{#!hs {-# LANGUAGE -- GeneralizedNewtypeDeriving, DeriveFoldable #-} module Derive where import qualified Data.IntMap as M newtype UniqFM ele = UFM {unUFM :: M.IntMap ele} deriving (Foldable) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: A module can't usefully use both GeneralizedNewtypeDeriving and DeriveFoldable -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by dfeuer): * component: Compiler => Compiler (Type checker) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: A module can't usefully use both GeneralizedNewtypeDeriving and DeriveFoldable -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 7.9 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by dfeuer): * cc: core-libraries-committee@… (added) * owner: => dfeuer * component: Compiler (Type checker) => Core Libraries Comment: Reid Barton thinks this is probably caused by the accidental redundant `Foldable` contexts on `Foldable` members. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: A module can't usefully use both GeneralizedNewtypeDeriving and DeriveFoldable -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 7.9 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): (To clarify, "this" = the fact that Foldable's parameter has type role nominal in HEAD, preventing GND. In 7.8 it has role representational, as it should.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: Foldable cannot be derived by GND due to redundant contexts -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: bug | Status: patch Priority: normal | Milestone: Component: Core | Version: 7.9 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: Phab:D425 | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => patch * differential: => Phab:D425 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: Foldable cannot be derived by GND due to redundant contexts -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: bug | Status: patch Priority: normal | Milestone: Component: Core | Version: 7.9 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: Phab:D425 | -------------------------------------+------------------------------------- Comment (by goldfire): As Mr. Role, I agree with the analysis reported in comment:2. (But, just to be pedantic, I disagree with the phrasing in comment:3. `Foldable` should most certainly have a nominal role on its parameter, because we don't want to be able to coerce an existentially-bound `Foldable` dictionary, as `Foldable MyList` and `Foldable []` might be different. However, the extra `Foldable` constraints do cause GND to fail, because the constraint gets instantiated before coercing, and then it looks like we're trying to coerce `Foldable []` to `Foldable MyList`, which is bad.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9761: Foldable cannot be derived by GND due to redundant contexts
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: dfeuer
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Core | Version: 7.9
Libraries | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: GHC | Related Tickets:
rejects valid program |
Test Case: |
Blocking: |
Differential Revisions: Phab:D425 |
-------------------------------------+-------------------------------------
Comment (by Herbert Valerio Riedel

#9761: Foldable cannot be derived by GND due to redundant contexts -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: bug | Status: closed Priority: normal | Milestone: Component: Core | Version: 7.9 Libraries | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: Phab:D425 | -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9761#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC