[GHC] #12907: ExtendedDefaultRules-related regression in GHC 8.0.2

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Compiler | Version: 8.0.2-rc1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Commit https://git.haskell.org/ghc.git/commit/9a34bf1985035858ece043bf38b47b6ff4b88... introduced a regression between GHC 8.0.1 and 8.0.2 regarding the behavior of `ExtendedDefaultRules`. In GHC 8.0.1, this program {{{#!hs module Bug where default (Bool) }}} would compile without issue. On GHC 8.0.2, however, it is rejected with this error message: {{{ $ /opt/ghc/8.0.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:3:1: error: • The default type ‘Bool’ is not an instance of ‘Num’ • When checking the types in a default declaration }}} As a result, the `shelly` library now fails to compile with GHC 8.0.2 (see https://github.com/yesodweb/Shelly.hs/issues/130). A workaround is to explicitly enable `ExtendedDefaultRules` at the top of the module. Richard, do you understand what's going on here? I'm not sure if this is a real regression or just GHC being more particular (admittedly, I don't understand many of the intricacies of `ExtendedDefaultRules`). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: goldfire (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): Just for the record, I consider this GHC being faithful to H2010 when it rejects the code {{{#!hs module Bug where default (Bool) }}} since [https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-790004.... 4.3.4] says:
Ambiguities in the class Num are most common, so Haskell provides another way to resolve them—with a default declaration: default (t1 , … , tn) where n ≥ 0, and each ti must be a type for which Num ti holds.
And `Bool` is not an instance of `Num`, hence the code above is not legal plain Haskell2010 code. Personally, I consider this a bugfix rather than a regression :-) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I agree with comment:2. The change to reject the program reported was intentional, following the Report. When `-XExtendedDefaultRules` is in effect, the program given is accepted, as `Bool` is a member of several of the classes defaultable under the extended rules. I'd be willing to consider other designs here, but I believe what's implemented is the most faithful to the Report. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2774 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D2774 Comment: Thanks, hvr, that section of the Haskell Report is helpful. And it's also nice to know that the author (goldfire) intended for this to happen. Now that I better understand all the actors in this production, I also agree that this behavior is reasonable. The only thing missing from https://git.haskell.org/ghc.git/commit/9a34bf1985035858ece043bf38b47b6ff4b88... was a note in the users' guide. I've opened Phab:D2774 for this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 8.0.2
Component: Compiler (Type | Version: 8.0.2-rc1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2774
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: merge Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2774 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => merge Comment: And with that, I think that takes care of all the 8.0.2 regressions that I discovered when smoke-testing Stackage. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12907: ExtendedDefaultRules-related regression in GHC 8.0.2 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.2-rc1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2774 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as 706d708a4bb74e27437ea2ec37e4999a4615b0e8. Thanks Ryan! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12907#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC