[GHC] #12120: GHC accepts invalid Haskell: `class Eq (a Int) => C a where`

#12120: GHC accepts invalid Haskell: `class Eq (a Int) => C a where` -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 8.0.1 Keywords: report-impact | Operating System: Unknown/Multiple Architecture: | Type of failure: Documentation Unknown/Multiple | bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- From the Haskell 2010 report [https://www.haskell.org/onlinereport/haskell2010/haskellch4.html chapter 4], * Class and instance declarations: {{{ | class [scontext =>] ... | instance [scontext =>] ... }}} * Normal type signatures: {{{ vars :: [context =>] ... }}} Notice the difference between `scontext` (//with// `s`) and `context` (without `s`). {{{ scontext → simpleclass | ( simpleclass1 , … , simpleclassn ) (n ≥ 0) simpleclass → qtycls tyvar }}} {{{ context → class | ( class1 , … , classn ) (n ≥ 0) class → qtycls tyvar | qtycls ( tyvar atype1 … atypen ) (n ≥ 1) }}} GHC seems to ignore this difference, and happily accepts `class Eq (a Int) => C a where`. Hugs (Version: September 2006) reports for that same example: {{{ Illegal Haskell 98 class constraint in class declaration *** Constraint : Eq (a Int) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12120 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12120: GHC accepts invalid Haskell: `class Eq (a Int) => C a where` -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: report-impact Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): I didn't see this mentioned in https://downloads.haskell.org/~ghc/master /users-guide/bugs.html. It probably should be, so that the Haskell 2020 commitee sees it, and perhaps lifts this restriction on class and instance declarations. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12120#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12120: GHC accepts invalid Haskell: `class Eq (a Int) => C a where` -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: report-impact Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Yes, as mentioned in #12121, I think this is a bug in GHC. Fixing it will probably mean that some working programs break, which will make people upset. Maybe we should just document it as a bug that we don't propose to fix? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12120#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC