danielnarey/elm-toolkit/6.2.0

NOTE: this package is not compatible with Elm 0.19.1

Toolkit.Result.Operators

Some experimental operators for error handling with Result values

(!=) : Result x a -> a -> a

Forward operator for Result.withDefault

String.toInt "123" != 0


--> 123


String.toInt "abc" != 0


--> 0
(!|>) : Result x a -> (a -> value) -> Result x value

Forward operator for Result.map

Ok 4.0
  !|> sqrt


--> Ok 2.0


Err "bad input"
  !|> sqrt


--> Err "bad input"
(!+>) : Result x a -> (a -> Result x b) -> Result x b

Forward operator for Result.andThen

String.toInt "1"
  !+> always (Err "ERROR")


--> Err "ERROR"