Conversation
|
Brap! |
kritzcreek
left a comment
There was a problem hiding this comment.
Looks good, a few style comments
|
|
||
| deriveEq1 | ||
| :: forall m | ||
| . (MonadError MultipleErrors m, MonadSupply m) |
There was a problem hiding this comment.
These constraints seem unnecessary?
|
|
||
| deriveOrd1 | ||
| :: forall m | ||
| . (MonadError MultipleErrors m, MonadSupply m) |
| | className == Qualified (Just dataEq) (ProperName "Eq1") | ||
| = case tys of | ||
| [ty] | Just (Qualified mn' _, _) <- unwrapTypeConstructor ty | ||
| , mn == fromMaybe mn mn' |
There was a problem hiding this comment.
maybe True (== mn) mn' ?
I was a little confused there for a second :D There's also the more obscure all (== mn) mn' but I think that's too cute :D
There was a problem hiding this comment.
I just copied exactly the form of the other matches here. There's some other cleaning up I'd like to do actually, but didn't want to mix it in this PR 😉 so I can change it, but maybe it'd be better to keep them consistent for now?
There was a problem hiding this comment.
Should've looked at the whole file 🤦♂️
| | className == Qualified (Just dataOrd) (ProperName "Ord1") | ||
| = case tys of | ||
| [ty] | Just (Qualified mn' _, _) <- unwrapTypeConstructor ty | ||
| , mn == fromMaybe mn mn' |
|
As evidenced by de9e5ac, this is actually a breaking change, since some things will require a constraint like |
|
Do you think we can detect these cases and suggest the usage of Eq1? |
|
I think the standard error message does a decent job of that anyway? |
|
If we can confirm that we can derive Eq1 for the type in question, I'd prefer us to add a hint to the error message: |
|
The "type in question" is The change is that now whenever attempting to derive
|
|
Just thinking out loud here, does that mean that all our derived |
|
It doesn't apply to type constructors, only applied-type-variables. It's a pretty rare case most likely :) |
|
Well okay, if it's such a rare case I'm not too worried. |
|
I'll merge this too if there are no other issues with it? |
|
Go for it! 🎉 |
Resolves #2702. Much simpler than the previous #2703 😄.
The
Eq1part is done, will do the same forOrd1now.