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
Is your feature request related to a problem? Please describe.
We have multiple CEs, like Result, Option, Task, TaskResult, TaskResultOption.
I am relatively new to f#, but it seems to me that it is impractical to work with TaskResultOption CE, even though for single expression it's clearly nice. But if we have various levels of expressions, e.g. TaskResultOption followed by TaskResult/Result, and for them to be inside taskResultOption CE, we need to keep converting all following expressions to highest denominator (TaskResultOption).
here is a code snippet, where Mode.Parse is a Result and we need to convert it to TaskResultOption to be able to follow linearly and extract success result, same with LoadUniverseForStrategy, which is TaskResult (but not an Option):
Is some kind of smart CE possible, that in case of using TaskResultOption would work using let! on TaskResult and friends?
Following snippet would be ideal:
Another option is using lower denominator like taskResult (and then conversion is simpler, but we need to resort to branching, which will become impractical once we need to pattern match more than once in a method):
taskResult {
let! strategy = this.LoadLatestStrategyQueryResult()
match strategy with
| None -> return None
| Some s ->
let! mode = Mode.Parse s.StrategyType
let! universe = this.LoadUniverseForStrategy s.Id
return
Some
{ Id = s.Id
Entry = s.Entry
Exit = s.Exit
Saved = s.Saved
Universe = universe
Mode = mode }
}
Maybe this is just me being a novice and not seeing a straightforward way forward.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We have multiple CEs, like Result, Option, Task, TaskResult, TaskResultOption.
I am relatively new to f#, but it seems to me that it is impractical to work with TaskResultOption CE, even though for single expression it's clearly nice. But if we have various levels of expressions, e.g. TaskResultOption followed by TaskResult/Result, and for them to be inside taskResultOption CE, we need to keep converting all following expressions to highest denominator (TaskResultOption).
here is a code snippet, where Mode.Parse is a
Result
and we need to convert it to TaskResultOption to be able to follow linearly and extract success result, same with LoadUniverseForStrategy, which isTaskResult
(but not anOption
):for clarity these are signatures:
Is some kind of smart CE possible, that in case of using TaskResultOption would work using let! on TaskResult and friends?
Following snippet would be ideal:
Another option is using lower denominator like
taskResult
(and then conversion is simpler, but we need to resort to branching, which will become impractical once we need to pattern match more than once in a method):Maybe this is just me being a novice and not seeing a straightforward way forward.
The text was updated successfully, but these errors were encountered: