danielnarey/elm-toolkit/6.1.1

NOTE: this package is not compatible with Elm 0.19.1

Toolkit.Maybe.Operators

Some experimental operators for error handling with Maybe values

(?=) : Maybe a -> a -> a

Forward operator for Maybe.withDefault

Just 42 ?= 100


--> 42


Nothing ?= 100


--> 100
(?|>) : Maybe a -> (a -> b) -> Maybe b

Forward operator for Maybe.map

Just 9
  ?|> sqrt


--> Just 3


Nothing
  ?|> sqrt


--> Nothing
(?+>) : Maybe a -> (a -> Maybe b) -> Maybe b

Forward operator for Maybe.andThen

List.head [1]
  ?+> always Nothing


--> Nothing