-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add more coercion rules #308
Comments
This would be nice. I came here to ask for a It's a very unsatisfying situation, because ideally we could just use |
@jberryman, we can offer these rules while maintaining a "standard Haskell" API. For coercing, we'd want setCoercion :: Coercible a b => Coercion (Set a) (Set b)
-- and/or
quantCo :: ((forall a b. Coercible a b => Coercible (Set a) (Set b)) => r) -> r Unfortunately, the nasty way type roles work for |
Yeah assumed, but wasn't totally sure if this was guaranteed to be safe (at least as safe as
(And my first comment was a little jumbled; if it wasn't clear I meant that it's a bit of a shame that
No, but I'd love to come up for one sometime if I can. Just subscribed to the meetup group. |
@jberryman What goes wrong with the safe version, as in
(defined within a module that has access to |
@jberryman that's definitely not safe. Consider
Then But I'm not sure if that goes off on a tangent WRT to the question you meant to discuss here. |
@dmwit, the type checker will reject that thanks to the F's parameter has a representational role |-
Coercible (F a) (F b) => Coercible a b
F's parameter has a nominal role |-
Coercible (F a) (F b) => a ~ b These can't work for |
Right, and the reason |
(If it's not obvious already, I think that they were wrong to take that "freebie" and that it should be removed. It's not actually very useful and it gets in the way of a variety of potential good things.) |
(Alternatively, there could be a "soft" role signature and a "hard" role signature, where only the latter enables the backwards reasoning.) |
mapMonotonic coerce = coerce
andmapKeysMonotonic coerce = coerce
, or so.The text was updated successfully, but these errors were encountered: