Open jasonkuhrt opened 11 years ago
Renaming as such would be incorrect
AKA in haskell
Maybe.map mapMaybe
Maybe.cat catMaybes
Maybe.to_list maybeToList
Maybe.list_to listToMaybe
Because e.g. Maybe.map
is reserved for the Functor
notion of map
which is different from what is intended by maybe_map
:
The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it just Just b, then b is included in the result list.
As seen from here:
http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Maybe.html#t:Maybe
We're still missing:
It would be nice to know/have a use-case for each before blindly porting them. the
map
use-case is exemplified in e.g. http://www.youtube.com/watch?v=m3svKOdZijAConsider that we probably want to omit
maybe
terms in function names given that we're invoking from theMaybe
namespace: