I'm translating this F# source for railway oriented programming to C#.
I'm having trouble translating this SelectMany
overload:
static member inline SelectMany (this:Result<'TSuccess, 'TMessage>, func: Func<_,_>, mapper: Func<_,_,_>) =
let mapper = lift2 (fun a b -> mapper.Invoke(a,b))
let v = bind func.Invoke this
mapper this v
I've mapped function signature with the above:
public static Result<TResult, TMessage> SelectMany<TSuccess, TMessage, TValue, TResult>(
this Result<TSuccess, TMessage> result,
Func<TSuccess, Result<TValue, TMessage>> func,
Func<TSuccess, TValue, TResult> mapperFunc)
F# lift2
function (that I think I've correctly translated) accepts as first parameter a function with signature ('a -> 'b -> 'c)
, but when bound to mapper
let-binding with partial application I've problem understanding the used lambda function.
I normally use these helpers for partial application, but I was not able to translate this F# code to C#.