[GHC] #9575: -XAutoDeriveTypeable fails to generate instances

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- The following doesn't compile with GHC 7.8.3, but works with GHC HEAD. I couldn't find a matching ticket, so I don't know if this was fixed knowingly or not... {{{#!hs {-# LANGUAGE AutoDeriveTypeable #-} import Data.Typeable (Typeable) data T1 = C1 Int deriving (Eq,Ord) tvoid :: Typeable a => a -> IO () tvoid _ = return () main :: IO () main = tvoid (C1 0) }}} ...fails for GHC 7.8.3 with {{{ No instance for (Typeable T1) arising from a use of ‘tvoid’ In the expression: tvoid (C1 0) In an equation for ‘main’: main = tvoid (C1 0) }}} I'm marking this with high priority, as it makes `-XAutoDeriveTypeable` unusable on GHC 7.8.3 as it stands. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by dreixel): * owner: => dreixel Comment: Removing `deriving (Eq,Ord)` makes it compile. I'll have a closer look. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): See ticket:8950#comment:3. I don't see what there is to gain by backporting a fix though, even if you could detect GHC 7.8.4, it's still more effort to do so than to just add `Typeable` to the deriving list. And it could break old code that uses `AutoDeriveTypeable`, by causing it to export more instances than it did under 7.8.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfeuer): It sounds to me like this ticket is mostly about making sure the necessary validation tests are in place. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:2 rwbarton]:
See ticket:8950#comment:3.
I don't see what there is to gain by backporting a fix though, even if you could detect GHC 7.8.4, it's still more effort to do so than to just add `Typeable` to the deriving list. And it could break old code that uses `AutoDeriveTypeable`, by causing it to export more instances than it did under 7.8.3.
How would this break old code (unless orphan instances are involved) by exporting //more// instances? However, at the very least this should be documented (unless it's easy enough to fix) as a known-bug in 7.8.4's manual (should 7.8.4 be ever be released). Or GHC 7.8.4 could even warn when -XAutoDeriveTypeable is used to raise awareness, that it doesn't work as advertised in GHC 7.8, so people don't start using it next year with GHC 7.10 (where it works as intended), and then assume it worked in GHC 7.8 as well. Alas, missing instances like `Typeable` go easily undetected in libraries. And fwiw, you can discriminate GHC 7.8.4 quite easily via Cabal's `if impl(ghc>=7.8.4) ...` conditionals... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Replying to [comment:4 hvr]:
How would this break old code (unless orphan instances are involved) by exporting //more// instances?
Yes, I mean with orphan instances. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T8950 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by dreixel): * testcase: => deriving/should_compile/T8950 Comment: `deriving/should_compile/T8950` already tests for this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: new Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T8950 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * milestone: 7.10.1 => 7.8.4 Comment:
`deriving/should_compile/T8950` already tests for this.
However, at the very least this should be documented (unless it's easy enough to fix) as a known-bug in 7.8.4's manual (should 7.8.4 be ever be released).
So this ticket can either be closed, or that documentation should be added. Reverting the milestone back to 7.8.4, since nothing needs to be done for 7.10.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9575: -XAutoDeriveTypeable fails to generate instances -------------------------------------+------------------------------------- Reporter: hvr | Owner: dreixel Type: bug | Status: closed Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T8950 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed Comment: Fixed by marking this in the 7.8.4 manual (see 7fa9d836e3b3e16d3d69a8954cf500dfaa3ea54e). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9575#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC