Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Created September 8, 2016 05:56
Show Gist options
  • Save masaru-b-cl/91d7f9cb8459c8727b19619300bae896 to your computer and use it in GitHub Desktop.
Save masaru-b-cl/91d7f9cb8459c8727b19619300bae896 to your computer and use it in GitHub Desktop.
Optionに見るコンピュテーション式のつくり方 - ぐるぐる~ の変換過程の私の理解
(*
Optionに見るコンピュテーション式のつくり方 - ぐるぐる~
http://bleis-tift.hatenablog.com/entry/how-to-make-computation-expression
のmatchSomeからこんぴゅーてーしょん式への変換過程の私なりの理解
*)
let niceFunction (arg1 arg2 arg3) =
matchSome (f arg1), (fun x ->
matchSome (g arg2), (fun y ->
matchSome (h arg3), (fun z ->
Some (x, y, z)
)))
let niceFunction (arg1 arg2 arg3) =
matchSome (f arg1), (fun x ->
matchSome (g arg2), (fun y ->
matchSome (h arg3), (fun z ->
Some (x, y, z)
)
)
)
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
matchSome (g arg2), (fun y ->
matchSome (h arg3), (fun z ->
Some (x, y, z)
)
)
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option.Bind((g arg2), (fun y ->
matchSome (h arg3), (fun z ->
Some (x, y, z)
)
))
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option.Bind((g arg2), (fun y ->
option.Bind((h arg3), (fun z ->
Some (x, y, z)
))
))
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option.Bind((g arg2), (fun y ->
option.Bind((h arg3), (fun z ->
option.Return( (x, y, z) )
))
))
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option.Bind((g arg2), (fun y ->
option.Bind((h arg3), (fun z ->
option {
return (x, y, z)
}
))
))
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option.Bind((g arg2), (fun y ->
option {
let! z = h arg3
return (x, y, z)
}
))
))
let niceFunction (arg1 arg2 arg3) =
option.Bind((f arg1), (fun x ->
option {
let! y = g arg2
let! z = h arg3
return (x, y, z)
}
))
let niceFunction (arg1 arg2 arg3) =
option {
let! x = f arg1
let! y = g arg2
let! z = h arg3
return (x, y, z)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment