Neteril.ComputationExpression
Neteril.ComputationExpression copied to clipboard
Wow!
I love it!, Im implementing your library with my own "monadic" types because linq has several limitations.
I have some questions:
is it possible to implement the "computation expressions" with types like Task<T> or Nullable<T>?
is it possible to implement the return! (like in F#)? Something like:
var result =
option(() => {
var val1 = await DoSomething(120);
var val2 = await DoSomething(val1);
var val3 = await DoSomething(val2);
if (val3 > 0)
return val3;
else
return await Option.None<int>();
});
I did some changes to the MonadAsyncMethodBuilder class and now I can use Task<T>, I guess that for Nullable I need to create a new class.
Also, I can use:
return await Option.None<int>();
inside the computation and it works;