Open Drup opened 5 years ago
That's why I use permission types of [`R]
and [`R | `W]
, because the former is a subtype of the latter:
let f env =
let i = txn ~c:r (env : [> `R | `W] env : > [`R ] env) @@ fun t -> readT t in
write env i
@madroach Except you have to use a type cast for this to work, even for txn ~c:r envw @@ fun t -> readT t
, which is extremely user-hostile.
It certainly is. You already suggested to remove the phantom type from Env.t. The only reason I see to keep it is consistency. The only other way to palliate this issue I can think of is good documentation… I don't mind either way of tackling this issue.
This can be closed?
Let's keep it open, if someone can think of something nice :)
Here is a nice puzzle for type apprentices: Figure out a signature of
M
so that this worksThe current version works, but as the downside that this doesn't: