[GHC] #14861: QuantifiedConstraints: Can't use forall'd variable in context
GHC
ghc-devs at haskell.org
Tue Feb 27 16:39:25 UTC 2018
#14861: QuantifiedConstraints: Can't use forall'd variable in context
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.5
checker) | Keywords:
Resolution: | QuantifiedConstraints wipT2893
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
If I have
{{{
instance forall p. Show p => Show T
}}}
then when I invoke the instance declaration I get a `Show beta` constraint
with absolutely nothing telling the compiler what `beta` should be. Yes,
it could be solved with `beta := Int` or a variety of other things. But
GHC never guesses.
Same here. You have
{{{
instance (forall p. c p => Foldable' f) -- Yikes: nothing constrains p
=> Foldable' (ECC1 c f) where
}}}
When the quantified constraint fires, to solve `Foldable' f`, it generates
`c beta` with no constraints whatsoever on `beta`. The fact that we have
in scope `c p` does not help, because it requires quessing that `beta :=
p`. Sorry!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14861#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list