odd type inference issue with 'validation', in F#

using the lib 'FsToolkit.ErrorHandling'

and the following code:

let f x =
    if x % 2 = 0 then Ok $"even {x}" else Error $"odd {x}"

let xx =
    validation {

        let! a = f 1
        and! b = f 2
        and! c = f 3

        return $"{a} {b} {c}"
    }

printfn $"{xx.GetType()}"

The output is a

Result<string, string list>

Or, more specifically:

Microsoft.FSharp.Core.FSharpResult2[System.String,Microsoft.FSharp.Collections.FSharpList1[System.String]]

But the IDE (Rider) sees it differently:

enter image description here

Is this an expected behavior for some reason? or could it be a bug?


Solution 1:

Validation<'a, 'err> is a type alias for Result<'a, 'err list>:

https://github.com/demystifyfp/FsToolkit.ErrorHandling/blob/f5019f10c4418426a2e182377be06beecd09876b/src/FsToolkit.ErrorHandling/Validation.fs#L3

This doesn't create a new type but creates a new way to refer to an existing type, which means that they can be used interchangeably.