elm-community / list-extra

Convenience functions for working with List.
http://package.elm-lang.org/packages/elm-community/list-extra/latest
MIT License
135 stars 59 forks source link

Adding `filterMap` method #46

Closed peterszerzo closed 7 years ago

peterszerzo commented 7 years ago

I recently found it useful to have a method that filters and maps a list at the same time, with the following type signature:

filterMap : (a -> ( b, Bool )) -> List a -> List b

The mapped value b is included in the resulting list if the boolean value returned in the tuple is true.

Does it make sense to include this in the library? If so, I have an implementation ready and happy to issue a PR.

jvoigtlaender commented 7 years ago

In what sense is this function preferable over http://package.elm-lang.org/packages/elm-lang/core/5.1.1/List#filterMap?

peterszerzo commented 7 years ago

It is not preferable at all, I overlooked :/. Thanks for reviewing the issue report so I can get it out of the way :).