[GHC] #10991: Don't permit type variables in the context unless they are in the type

GHC ghc-devs at haskell.org
Tue Oct 20 13:50:05 UTC 2015


#10991: Don't permit type variables in the context unless they are in the type
-------------------------------------+-------------------------------------
        Reporter:  bernalex          |                Owner:  bernalex
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:
  checker)                           |
      Resolution:  invalid           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 GHCi sets [https://downloads.haskell.org/~ghc/7.10.2/docs/html/users_guide
 /interactive-evaluation.html#extended-default-rules
 `-XExtendedDefaultRules`], which is the reason why your code is accepted.


 The following snippet is
 [https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-750004.3
 valid Haskell], and thus always accepted, even when first running `:set
 -XNoExtendedDefaultRules` (note that because of #10857, running `ghci
 -XNoExtendedDefaultRules` doesn't work currently):
 {{{
 let h :: Num a => b -> b; h b = b
 }}}


 The following is always rejected (only Show, Eq, and Ord are treated
 specially with `-XExtendedDefaultRules`):
 {{{
 let g :: Read a => b -> b; g b = b
 }}}

 I don't think there is a bug here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10991#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list