[GHC] #11793: Confusing type error from constrained class method
GHC
ghc-devs at haskell.org
Wed Apr 6 13:31:48 UTC 2016
#11793: Confusing type error from constrained class method
-------------------------------------+-------------------------------------
Reporter: gridaphobe | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 8.0.1-rc2
Resolution: | Keywords: error-message
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
The original issue was this. Haskell has always allowed you to write
{{{
class C a where
foo :: forall b. Ord b => blah
}}}
(I'm using an explicit forall, which original Haskell didn't, but only to
stress where the quantification is.)
But Haskell 98 did not allow
{{{
class C a where
foo :: Ord a => blah
}}}
which added an extra constraint on the class variable 'a'.
This was not checked by GHC 7.10, see #7854. I added the test in
`f66e0e6`.
But if we have implicit params should we allow
{{{
class C a where
foo :: ?x::Int => a -> a
}}}
Presumably yes. So give a constraint with free tyvars `pred_tvs`, the
test should perhaps be
* `pred_tvs` is not empty, and
* All of the `pred_tvs` are class variables
Under those circumstances, reject, unless `ConstrainedClassMethods` is on.
I'll do that; it's easy.
Simon
GHC has no truck with such restrictions, hence the extension. But when
you don't have the extension on
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11793#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list