3 ms·
In general you can't take the value from the box: you can't make an async computation non-async; you can't make a non-deterministic function deterministic; you
by codebje 4y ago
In general you can't take the value from the box: you can't make an async computation non-async; you can't make a non-deterministic function deterministic; you can't make a possibly-failed result successful.
The await keyword might make it look like you can escape the box - but in effect a statement like "let x = await y" is just expanding the async box around y to also be around the bock containing that statement.
Since we already have a function to take a plain value to one in a box ((1) above) and a way to apply a function that turns a value from a box into another boxed value, lifting is just function composition:
box.lift(f) = box.map(val -> from(f(val)))