When looking at the code for apply, it seems to only concat all the messages when either both results are Ok or both are Bad. Should it concat all the message regardless?
And instead of giving me all the messages it just gives me the first after a failure.
If I rewrite the middle two cases of apply I appear to get what I am after.
So is this a bug, enhancement, or am I actually asking for different function other then apply, like applyWithAllMessage <*+>?
/// If the wrapped function is a success and the given result is a success the function is applied on the value.
/// Otherwise the exisiting error messages are propagated.
let inline apply wrappedFunction result =
match wrappedFunction, result with
| Ok(f, msgs1), Ok(x, msgs2) -> Ok(f x, msgs1 @ msgs2)
| Bad errs, Ok(_, msgs) -> Bad(errs @ msgs)
| Ok(_, msgs), Bad errs -> Bad(errs @ msgs)
| Bad errs1, Bad errs2 -> Bad(errs1 @ errs2)
My apologies, I saw #20, I think I am using an old release from the nuget package so I actually was encountering the bug for the last case of concat two failures.
When looking at the code for apply, it seems to only concat all the messages when either both results are Ok or both are Bad. Should it concat all the message regardless?
https://github.com/fsprojects/Chessie/blob/7c31c30f70b1fb12401471642904c3d17f58c9cc/src/Chessie/ErrorHandling.fs#L105-L106
I am trying to return a list of failure messages when using apply
And instead of giving me all the messages it just gives me the first after a failure. If I rewrite the middle two cases of apply I appear to get what I am after.
So is this a bug, enhancement, or am I actually asking for different function other then apply, like applyWithAllMessage <*+>?