Skip to content

Commit

Permalink
Merge 5cf15b7 into 8107550
Browse files Browse the repository at this point in the history
  • Loading branch information
dalefrancis88 committed Mar 3, 2019
2 parents 8107550 + 5cf15b7 commit 5242be8
Show file tree
Hide file tree
Showing 8 changed files with 1,589 additions and 36 deletions.
11 changes: 6 additions & 5 deletions docs/src/pages/docs/crocks/Async.md
Original file line number Diff line number Diff line change
Expand Up @@ -1711,17 +1711,17 @@ resultToAsync :: Result b a -> Async b a
resultToAsync :: (a -> Result c b) -> a -> Async c b
```

Used to transform a given `Result` instance to an `Async` instance or flatten an
`Async` of `Result` into an `Async` when chained, `resultToAsync` will turn an
Used to transform a given [`Result`][result] instance to an `Async` instance or flatten an
`Async` of [`Result`][result] into an `Async` when chained, `resultToAsync` will turn an
`Ok` instance into a [`Resolved`](#resolved) instance wrapping the original
value contained in the original `Ok`. If an `Err` is provided, then
`resultToAsync` will return a [`Rejected`](#rejected) instance, wrapping the
original `Err` value.

Like all `crocks` transformation functions, `resultToAsync` has two possible
signatures and will behave differently when passed either a `Result` instance
or a function that returns an instance of `Result`. When passed the instance,
a transformed `Async` is returned. When passed a `Result` returning function,
signatures and will behave differently when passed either a [`Result`][result] instance
or a function that returns an instance of [`Result`][result]. When passed the instance,
a transformed `Async` is returned. When passed a [`Result`][result] returning function,
a function will be returned that takes a given value and returns an `Async`.

<!-- eslint-disable no-console -->
Expand Down Expand Up @@ -1802,3 +1802,4 @@ Resolved(Ok('Success!'))
[either]: ./Either.html
[left]: ./Either.html#left
[right]: ./Either.html#right
[result]: ./Result.html
11 changes: 6 additions & 5 deletions docs/src/pages/docs/crocks/Either.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,16 +1283,16 @@ resultToEither :: Result e a -> Either e a
resultToEither :: (a -> Result e b) -> a -> Either e a
```

Used to transform a given `Result` instance to an `Either` instance or flatten
an `Either` of `Result` into an `Either` when chained, `resultToEither` will
Used to transform a given [`Result`][result] instance to an `Either` instance or flatten
an `Either` of [`Result`][result] into an `Either` when chained, `resultToEither` will
turn an `Ok` instance into a [`Right`](#right) instance wrapping the value
contained in the original `Ok`. If an `Err` is provided, then `resultToEither`
will return a [`Left`](#left) instance, wrapping the original `Err` value.

Like all `crocks` transformation functions, `resultToEither` has two possible
signatures and will behave differently when passed either a `Result` instance
or a function that returns an instance of `Result`. When passed the instance,
a transformed `Either` is returned. When passed a `Result` returning function,
signatures and will behave differently when passed either a [`Result`][result] instance
or a function that returns an instance of [`Result`][result]. When passed the instance,
a transformed `Either` is returned. When passed a [`Result`][result] returning function,
a function will be returned that takes a given value and returns an `Either`.

```javascript
Expand Down Expand Up @@ -1376,3 +1376,4 @@ Right(Ok('42'))
[maybe]: ./Maybe.html
[nothing]: ./Maybe.html#nothing
[just]: ./Maybe.html#just
[result]: ./Result.html
11 changes: 6 additions & 5 deletions docs/src/pages/docs/crocks/Maybe.md
Original file line number Diff line number Diff line change
Expand Up @@ -1530,18 +1530,18 @@ resultToMaybe :: Result e a -> Maybe a
resultToMaybe :: (a -> Result e b) -> a -> Maybe b
```

Used to transform a given `Result` instance to a `Maybe`
instance or flatten a `Maybe` of `Result` into a `Maybe` when chained,
Used to transform a given [`Result`][result] instance to a `Maybe`
instance or flatten a `Maybe` of [`Result`][result] into a `Maybe` when chained,
`resultToMaybe` will turn an `Ok` instance into a [`Just`](#just) wrapping the
original value contained in the `Ok`.
All `Err` instances will map to a [`Nothing`](#nothing), mapping the originally
contained value to a `Unit`. Values on the `Err` will be lost and as such this
transformation is considered lossy in that regard.

Like all `crocks` transformation functions, `resultToMaybe` has two possible
signatures and will behave differently when passed either an `Result` instance
or a function that returns an instance of `Result`. When passed the instance,
a transformed `Maybe` is returned. When passed a `Result` returning function,
signatures and will behave differently when passed either an [`Result`][result] instance
or a function that returns an instance of [`Result`][result]. When passed the instance,
a transformed `Maybe` is returned. When passed a [`Result`][result] returning function,
a function will be returned that takes a given value and returns a `Maybe`.

```javascript
Expand Down Expand Up @@ -1596,3 +1596,4 @@ Just(Err('to be human'))
[right]: ./Either.html#right
[first]: ../monoids/First.html
[last]: ../monoids/Last.html
[result]: ./Result.html

0 comments on commit 5242be8

Please sign in to comment.