Neteril.ComputationExpression icon indicating copy to clipboard operation
Neteril.ComputationExpression copied to clipboard

Wow!

Open desarrollo03TR opened this issue 7 years ago • 1 comments

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>();
   });

desarrollo03TR avatar Jan 23 '18 04:01 desarrollo03TR

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;

desarrollo03TR avatar Jan 24 '18 19:01 desarrollo03TR