Skip to content

Shortcut for flatMap on possibly falsy data (flatMapFromFalsy) #217

@tvedtorama

Description

@tvedtorama

I find myself writing this all the time:

maybe.flatMap(x => Maybe.fromFalsy(x.value)).

It would be very useful to have an

maybe.flatMapFromFalsy(x => x.value)

or

maybe.flatMap(x => x.value, Maybe.fromFalsy)
// Which can also be used with other constructors:
maybe.flatMap(x => x.value, Maybe.fromNull)

Does this make sense, or am I perhaps using the library a bit wrong?

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