2

atype r = {A : int; B : string; C : int; D : string}と a の値があるとします。

let aOptional : int option = ...
let bOptional : string option = ...
let cOptional : int option = ...
let dOptional : string option = ...

それらからどのようr optionalにエレガントに構築できますか(ネストされたケースなどなしで)?


ところで、haskellでControl.Applicative次のように実行する方法は次のとおりです。

data R = R { a :: Integer, b :: String, c :: Integer, d :: String}

R <$> aOptional <*> bOptional <*> cOptional <*> dOptional :: Maybe R

fsharp で同等のものを探しています。

4

2 に答える 2