Created
August 10, 2017 05:28
-
-
Save adambard/4eee89ba45a316e3ec8e82dccf18d8c1 to your computer and use it in GitHub Desktop.
map, bind, and unit for F# Async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Microsoft.FSharp.Control.Async with | |
static member unit (t:'T) : Async<'T> = async { return t } | |
static member bind (fn:'T -> Async<'U>) (t: Async<'T>) : Async<'U> = | |
async { | |
let! input = t | |
return! fn(input) | |
} | |
static member map (fn:'T -> 'U) (t:Async<'T>) : Async<'U> = | |
async { | |
let! input = t | |
return fn(input) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment