You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have two functions which are asnyc because they get data asynchronosly, the second function needs the value of the first, a typcal sitation for SelectMany:
Task<Option<int>>GetId()=> ...Task<Option<int>>GetObjectById(int)=> ...// type bingo!Option<int> y =(await(awaitGetId()).Select(x =>f(x))).SelectMany(Identity);
If the functions would not be async we could easily use the typical SelectMany pipelines, ideally we would have something like this:
GetId().SelectMany(GetObjectById)
or
fromidinGetId()fromoinGetObjectById(id)selecto;
The same applies to the other Monads (Either, Reader)
The text was updated successfully, but these errors were encountered:
Example:
We have two functions which are asnyc because they get data asynchronosly, the second function needs the value of the first, a typcal sitation for SelectMany:
If the functions would not be async we could easily use the typical SelectMany pipelines, ideally we would have something like this:
or
The text was updated successfully, but these errors were encountered: