Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Result/Extra.elm
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,13 @@ original value when a predicate matches.
-}
filter : e -> (a -> Bool) -> Result e a -> Result e a
filter err predicate result =
case Result.map predicate result of
Ok True ->
result
case result of
Ok a ->
if predicate a then
result

Ok False ->
Err err
else
Err err

Err _ ->
result
Expand Down