Skip to content

Add expect : Bool -> Maybe () #63

@LightAndLight

Description

@LightAndLight

In Haskell: https://hackage.haskell.org/package/base-4.15.0.0/docs/Control-Monad.html#v:guard

expect : Bool -> Maybe ()
expect b = if b then Just () else Nothing

This is is used to short-circuit Maybe computations based on a condition:

Maybe.expect thisMustBeTrue |>
  Maybe.andThen (\() ->
    -- only run when the condition is true
  )

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