-
Notifications
You must be signed in to change notification settings - Fork 58
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 UnliftedRef #198
Comments
I don’t quite understand what you mean. Would this just be backed by an UnliftedArray of length 1? |
I mean backed by a data RuntimeRep
= PtrRep Levity
| ...
data Levity = Lifted | Unlifted
type Type = TYPE ('PtrRep 'Lifted)
data MutableArray# :: Type -> TYPE ('PtrRep levity) -> TYPE ('PtrRep 'Unlifted)
data MutVar# :: Type -> TYPE ('PtrRep levity) -> TYPE ('PtrRep 'Unlifted)
... In that regime, most |
Ah, thanks for clarifying. Now I get it. This seems reasonable, and it should work. It would be nice to fix |
OTOH, maybe that doesn't help much. We still couldn't write user functions that didn't care about levity.... |
True. We could unify the types but we would still need an extra copy of all the functions. Unless someone finds a good way to allow levity polymorphism in binding positions. |
Since GHC 9.4, |
I believe we should be able to
unsafeCoerce#
our way into references containingTYPE 'UnliftedRep
. This is horrible, of course, but also useful. We can support all the usualMutVar
operations exceptatomicModifyMutVar*
ones.The text was updated successfully, but these errors were encountered: