Last active
January 23, 2019 01:54
-
-
Save dam5s/392851fdc1a905af5191d48978bd856a to your computer and use it in GitHub Desktop.
Revisions
-
dam5s revised this gist
Jan 23, 2019 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,9 @@ type AsyncResult<'T, 'TError> = module AsyncResult = let map (mapping : 'T -> 'U) (result : AsyncResult<'T, 'TError>) : AsyncResult<'U, 'TError> = async { match! result with | Ok value -> return Ok (mapping value) | Error err -> return Error err } let bind (mapping : 'T -> AsyncResult<'U, 'TError>) (result : AsyncResult<'T, 'TError>) : AsyncResult<'U, 'TError> = -
dam5s created this gist
Jan 23, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ [<AutoOpen>] module Prelude type AsyncResult<'T, 'TError> = Async<Result<'T, 'TError>> module AsyncResult = let map (mapping : 'T -> 'U) (result : AsyncResult<'T, 'TError>) : AsyncResult<'U, 'TError> = async { let! r = result return Result.map mapping r } let bind (mapping : 'T -> AsyncResult<'U, 'TError>) (result : AsyncResult<'T, 'TError>) : AsyncResult<'U, 'TError> = async { match! result with | Ok value -> return! mapping value | Error err -> return Error err }