Skip to content

Commit

Permalink
Faster filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Oct 20, 2021
1 parent 7f60f43 commit 8a4d6b3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Maybe/Extra.elm
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ join mx =
-}
filter : (a -> Bool) -> Maybe a -> Maybe a
filter f m =
case Maybe.map f m of
Just True ->
m
case m of
Just a ->
if f a then
m

_ ->
else
Nothing

Nothing ->
Nothing


Expand Down

0 comments on commit 8a4d6b3

Please sign in to comment.