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
Unidirectional Coercible #198
Comments
This has been in the back of our heads for a while. But there are a few can of worms, such as now type constructors have not only roles, but also variances.... |
I agree that this would be nice, but doing it right would take at least one peer-reviewed publication, perhaps more. Indeed we would need variances, but we also need a new theory of FC/Core that can deal with non-symmetrical coercions. This would be interesting for me to pursue (and it's related to ideas I've wanted to write about), but no one should hold their breath. |
Linear types could use unidirectional |
Is this ticket achieving any goal right now? I move to close it. This won't be solved anytime soon, I don't think. |
It's a feature request.
If this is ground for closing, so be it. I think it's good to have it open as a reminder that this is a desired feature, but I don't feel strongly. |
I actually agree with @int-index here. I will leave open and label accordingly. (The close/open below is purely an accidental button press -- there is absolutely no intention there.) |
With dependent types is there a way to somehow add a proof obligation? Taking the instance Coercible (NonNegative a) a but in the other direction.. I assume this won't make sense but it doesn't hurt to ask instance pi (x :: a). (Num a, Ord a, x >= 0) => Coercible a (NonNegative a) |
I like this. One small tweak: instance pi (x :: a). (Num a, Ord a, (x >= 0) ~ True) => Coercible a (NonNegative a) |
For newtypes that guarantee some invariant, we might want to coerce in one direction (unwrap) but not the other.
Right now the only option is to not export the constructor, which makes both directions of
coerce
unavailable.The text was updated successfully, but these errors were encountered: