Skip to content

Commit

Permalink
Add mapError
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamil Maqdis Anton committed Nov 30, 2020
1 parent cfaefd3 commit dd3ed50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/AsyncResult.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module AsyncResultOperators =

namespace FSharp.Prelude

open FSharp.Prelude
open FSharp.Prelude.Operators.AsyncResult
open System.Threading.Tasks

Expand All @@ -45,6 +46,9 @@ module AsyncResult =

let bind (f: 'a -> AsyncResult<'b, 'e>) (asyncResult: AsyncResult<'a, 'e>): AsyncResult<'b, 'e> = f >>= asyncResult

let mapError (f: 'e1 -> 'e2) (asyncResult: AsyncResult<'a, 'e1>): AsyncResult<'a, 'e2> =
Async.map (Result.mapError f) asyncResult

let bindError (f: 'e1 -> AsyncResult<'a, 'e2>) (asyncResult: AsyncResult<'a, 'e1>): AsyncResult<'a, 'e2> =
Async.bind (function
| Ok ok -> singleton ok
Expand Down

0 comments on commit dd3ed50

Please sign in to comment.