Skip to content

new function: andThenAttempt #60

@skyqrose

Description

@skyqrose

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions