You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find this pattern often in various cases where i want to map an optional value or put a default if its nothing but keep it optional.
mapOr: (a->b) ->b->Maybea->MaybebmapOr fn default ma =case ma of Nothing->Just default
Just a ->Just(fn a)-- Changes :
ma |>Maybe.map f |>Maybe.withDefault d |>Just-- or
ma |>Maybe.map f |>Maybe.Extra.orElse (Just d)-- To :
ma |>MapOr f d
The text was updated successfully, but these errors were encountered:
I find this pattern often in various cases where i want to map an optional value or put a default if its nothing but keep it optional.
The text was updated successfully, but these errors were encountered: