[GHC] #14733: Won't use (forall xx. f xx) with -XQuantifiedConstraints
GHC
ghc-devs at haskell.org
Mon Jan 29 23:45:10 UTC 2018
#14733: Won't use (forall xx. f xx) with -XQuantifiedConstraints
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords:
| QuantifiedContexts wipT2893
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 simonpj):
Currently this is by-design, but we could change the design.
These forall-constraints currently behave just like a local version of a
top-level instance declaration, and those are all for classes. You can't
say
{{{
instance ... => f Int
}}}
although it'd make sense to do so. So similarly you currently can't do
that with the local-foralld constraints.
* If we retain the restriction to class constraints only, we should reject
the type signature with a civilised error message.
* How bad is the restriction? You can always say
{{{
class f a => C f a
proof :: (forall xx. C f xx) => D (f a)
}}}
Would that do? Or what do your use-cases look like?
It'd be a moderate pain to generalise the facility, mainly because
`InstEnv` (in which we look up instances) has class constraints as a
deeply-baked-in assumption.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14733#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list