The Result type is used to represent computations
that may succeed or fail.
This should be used instead of the more genereic Either.
Many other functional programming languages also support Result types:
| Language | Type Name | Success | Error | Documentation |
|---|---|---|---|---|
| Elm | Result error value |
Ok | Err | doc.rust-lang.org/book |
| Rust | Result<T, E> |
Ok | Err | package.elm-lang.org |
| OCaml | ('a, 'b) result |
Ok | Error | ocaml.org/learn |
| F# | Result<'T,'TError> |
Ok | Error | docs.microsoft.com |
I'm not a fan of useless abbreviations (as if 3 instead of 5 characters would make a difference) but a fan of readability and pronounceability of code (e.g. dictating your coworker a snippet of code) and therefore this package uses:
data Result error value = Error error | Ok valueBecause how typeclasses work in PureScript it must be Result error value
and not Result value error, so that the value can be maped.
(details)
bower install --save purescript-result
Module documentation is published on Pursuit.
Deployment of new version:
npx pulp test
npx pulp version
npx pulp publish