new function: andThenAttempt
skyqrose opened this issue · comments
Sky Rose commented
Like andThen
, but it can fall back to the original value if the function fails.
andThenAttempt : (a -> Maybe a) -> Maybe a -> Maybe a
andThenAttempt f a =
a
|> Maybe.andThen f
|> orElse a
This would require some investigation to see if it's a common enough use case to include. If you would use this in your projects, comment with your use case.