-
Notifications
You must be signed in to change notification settings - Fork 14
WIP: Add quantified constraint superclasses #21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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@@ -108,6 +81,9 @@ type GRead :: (k -> Type) -> Constraint | |||
class GRead t where | |||
greadsPrec :: Int -> GReadS t | |||
|
|||
-- (forall a. Read (t a)) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.