Parallel async bindings, how cool is that? (Imagine if you could declare multiple `await` bindings in parallel)https://github.com/janestreet/ppx_let#parallel-bindings …
type Ret<T> = {done:true,value:T}; type Next<T> = {done:false,value:T}; 1/
-
-
interface Generator<N, R> { next(): Next<N>|Ret<R>; return(v:R):Ret<R>; throw(e:Error):Next<N>|Ret<R>; } 2/2
-
Or something... I don't see why it's that hard to type.
-
There is a problem with `next`: it takes an argument, but not when you call it for the first time
-
And you don't want unions because it doesn't capture the fact that it's wrong to pass nothing after the first?
-
right, union would be incorrect
-
But it's not quite `any` right? Even strongly typed languages sometimes use Option/Maybe types to deal with state changes.
-
The only safe option with current generator API is to make it require type `T` all the time.
-
then you can opt in to omit the first time using `any`. This is much safer than union
- 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.