WIP: Add quantified constraint superclasses#21
WIP: Add quantified constraint superclasses#21Ericson2314 wants to merge 1 commit intohaskellari:masterfrom
Conversation
phadej
left a comment
There was a problem hiding this comment.
i won't accept PRs making API conditional to GHC version.
I'm also don't feel bumping GHC support to GHC-8.6 just yet.
I also don't understand the motivation. I'd recommend to not use this class for anything else other than an auxiliary class for Show (Some f) instance.
src/Data/GADT/Internal.hs
Outdated
| #if __GLASGOW_HASKELL__ >= 806 | ||
| , forall x. Show (a x) | ||
| , forall x. Show (b x) | ||
| #endif |
There was a problem hiding this comment.
i don't understand this. shouldn't GShow a imply forall x. Show (a x), because it's class forall x. Show (t x)) => GShow t. Why GHC doesn't accept this?
|
So since this PR was written, I made haskell/core-libraries-committee#10. That has has the superclass for the same reason.
|
|
It's not identifical to |
|
Yes. Let's reconsider this when i bump the lower bound to GHC-8.6. i don't see a need to do that. (if that going to happen I'd probably just remove the class all-together). |
|
I'll just turn this to a 8.6+ PR that does quantified constraints for all the classes. And mark it draft. |
forall a. Show (t a) superclass to GShow -- contains #20| class GRead t where | ||
| greadsPrec :: Int -> GReadS t | ||
|
|
||
| -- (forall a. Read (t a)) => |
There was a problem hiding this comment.
Really should be
| -- (forall a. Read (t a)) => | |
| -- (exists a. Read (t a)) => |
GRead ((:~:) a) only reads a :~: a, we're not going to create non-trivial :~: out of nothing. Likewise, in #45 we have
instance forall k1 k2 (a :: k1). k1 ~ k2 => GRead ((:~~:) a :: k2 -> Type)which is more clearly written (at the cost of less back compat) as
instance forall k1 k2 (a :: k1). k1 ~ k2 => GRead ((:~~:) @k1 @k2 a)We can only attempt to read when the kinds are the same and there isn't, in fact, any heterogeneity.
This will not work unless haskell/core-libraries-committee#10 is accepted.
|
Once GHC 9.6 comes out we can give this another look. |
This will not work unless haskell/core-libraries-committee#10 is accepted.