Closed jpierson closed 5 years ago
Actually, the correct type of Handle is
Handle<T> : IEffect<T> -> Task
and the reason is that we need to compose it with Run
Run<T> : Eff<T> -> IEffectHandler -> Task<T>
Of course we can define our own Run and Handlers.
I tried getting the example in the Readme.md file working in LinqPad to play around with more to see if I could make sense out of your explanation above but unfortunately I'm hitting the following error.
CS0117 'Effect' does not contain a definition for 'Random'
http://share.linqpad.net/qrh376.linq
Glancing through the source code I haven't spotted a method called Random on Effect that would allow this example to compile as is. My guess is that I'm overlooking something.
The example is not complete, is only for demonstration purposes.
Note that the RandomEffect in the readme example comes from the following example project in the solution.
I believe RandomEffect is an example of a user-defined Effect. Is that correct @palladin ?
Yes!
What is the purpose of returning the type ValueTask from Handle in the main example from README.md. Additionally this method is async but doesn't await anything awaitable, is this intentional as it seems that the async keyword could just be omitted in the example?