-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I'm noticing I'm doing a lot of
(a -> b -> b) -> b -> Maybe a -> b
when manipulating a couple of arrays. I'll get a value from array1 which is a Maybe value
, and then apply it to array2 if it exists.
My code has lots of
case Array.get index1 array1 of
Just value ->
Array.set index2 value array2
Nothing ->
array2
given that's a signature for a fold, is it worth adding it? Which would give
Array.get index1 array1
|> Maybe.Extra.foldl (Array.set index2) array2
Metadata
Metadata
Assignees
Labels
No labels