elm-community/result-extra/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Result.Extra

Convenience functions for working with Result

Common Helpers

isOk : Result e a -> Bool

Check whether the result is Ok without unwrapping it.

isErr : Result e a -> Bool

Check whether the result is Err without unwrapping it.

extract : (e -> a) -> Result e a -> a

Turn a Result e a to an a, by applying the conversion function specified to the e.

mapBoth : (e -> b) -> (a -> b) -> Result e a -> b

Convert a Result e a to a b by applying either a function if the Result is an Err or a function if the Result is Ok. Both of these functions must return the same type.

combine : List (Result x a) -> Result x (List a)

Combine a list of results into a single result (holding a list).