--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
filter : List (Maybe a) -> List aAs an outsider, compact would be the most familiar and understandable to me (from Ruby, among others). compactMap would be less so, but I could easily guess what mapCompact does.
concatMap = concat << map -- i.o.w. concatMap f = concat (map f)
compactMap = compact << map -- i.o.w. compactMap f = compact (map f)
isJust : Maybe a -> Bool
isNothing : Maybe a -> Bool
isOk : Result error value -> Bool
isErr : Result error value -> BoolkeepIf isJust [Just 2,Just 4,Nothing, Just 42] --[2,4,42]It may be a side note, but ideally flatten and flatMap will one day also flatten a Maybe as if it were a list. I think this works in Scala already. Then you don't need a special function for it. I know this is a future item because currently there is no language facility to support this. But it's something to keep in mind...
Whatever name is chosen may eventually be removed or become a synonym for flatten.
So putting flatten in the name might help. Like if they're was a package called MaybeList it could be MaybeList.flatten. Or List.flattenMaybes?
--
Evan, I know you are (1) busy with promises (2) always reluctant to make hard changes, but I would go ahead and jump on this. You can add the new functions and deprecation warnings, and drop the old ones whenever core/2.0.0 comes out. Don't worry too much about flatMap not being flattenMap.
Evan, I know you are (1) busy with promises (2) always reluctant to make hard changes, but I would go ahead and jump on this. You can add the new functions and deprecation warnings, and drop the old ones whenever core/2.0.0 comes out. Don't worry too much about flatMap not being flattenMap.I had been thinking of adding filter/filterMap or compact/compactMap to an elm-list-extra package for people that want to get ahead of core in the mean time. Just waiting for a free moment and to make sure consensus has been reached...