-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing error with QuantifiedConstraints
#89
Comments
This is actually a GHC issue in deep disguise. The issue is that on GHC 8.6, That particular restriction has been lifted in GHC HEAD. That being said, your code still won't compile on GHC HEAD for another reason:
That limitation is due to a much deeper limitation of |
On the first glance, I knew this looked too good to be true! Thank you for the explanation, Ryan! |
I take it this issue can be closed, then? |
Sure! |
I'll try to use the Simon's Hack at https://ghc.haskell.org/trac/ghc/ticket/14860#comment:1 as a workaround.. |
..or even the option by IcelandJack: https://gist.github.com/Icelandjack/aeda8e98214cc52c96230af7b8724d25 |
I don't think I've had a problem with And regardless of the error message or GHC bugs, I don't think the quantified constraint could possibly be correct. You'd need an |
I'll reopen this for now because So let's have this discussion at least. We can always close again if there's no clear improvement over the status quo that we could apply. |
I have the I'll try to find some time to extract it, hopefully soon enough.. |
First, I apologise in advance, if this is not a valid place for such issues, so please feel free to close this, if that's the case.
The problem is that using
QuantifiedConstraints
to enforceCode
constraint results in a confusing type error, that doesn't appears to make sense.The goal is to:
'[xs]
)Code
)This seems to require
QuantifiedConstraints
, because:I. I could find no other way to encode the
Code a ~ '[xs]
constraint (f.e.Code a ~ '[Head (Code a)]
makes GHC blow reduction stack.II.
Code a ~ '[xs]
requires a type variable, which I'm hesitant to admit into the typeclass, because of requirement 3..however, using
QuantifiedConstraints
to introduce a fresh variable fails in a confusing way:..leads to:
..which appears contradictory, because:
Code a ~ '[xs]
is explicitly stated in the instancexs
andxs0
or somesuch is reported (which is typical when unification fails due to existentials not aligning).The text was updated successfully, but these errors were encountered: