On Dec 2, 2016 6:14 PM, "David Menendez" <dave@zednenem.com> wrote:A while back, I found myself deriving this class:class Functor f => Siftable f wheresiftWith :: (a -> Maybe b) -> f a -> f bsift :: (a -> Bool) -> f a -> f asift f = siftWith (\a -> if f a then Just a else Nothing)I would expect several classes, corresponding to different methods of Witherable:class Siftable a m | m -> a wheresift :: (a -> Bool) -> m -> mdefault sift :: SiftWithable f => (a -> Bool) -> f a -> f asift p = siftWith (\x -> x <$ guard (p x))class Functor f => SiftWithable f wheresiftWith :: (a -> Maybe b) -> f a -> f bclass Siftable a m => SiftableA a m wheresiftA :: Applicative g => (a -> g Bool) -> m -> g mdefault siftA :: (SiftWithAAble f, Applicative g) => (a -> g Bool) -> f a -> g (f a)siftA p = siftWithA (\x -> (x <$) . guard <$> p x)class (Traversable f, SiftWithAble f) => SiftWithAAble f wheresiftWithA :: Applicative g => (a -> g (Maybe b)) -> f a -> g (f a)