
18 Feb
2016
18 Feb
'16
2:01 a.m.
On 17/02/2016, Chris Wong
On Thu, Feb 18, 2016 at 1:57 PM, martin
wrote: The only need for the functor requirement is in the default definition of mapMaybe - so why not drop it?
Since fmap can be defined in terms of mapMaybe:
fmap f = mapMaybe (Just . f)
Filtrable should imply Functor in the same way that Traversable implies Foldable.
I think the notion is to make mapMaybe not a class method, and rather define it on its own: mapMaybe f :: (Functor f, Filtrable f) => (a -> Maybe b) -> f a -> f b mapMaybe f = catMaybes . fmap f I like this idea, but worry what the laws would be...