witherable
宿りせし花橘も枯れなくになど郭公声絶えぬらむ - 大江千里
要素を除去できるという性質を付与したTraversableの派生、Witherableを提供するライブラリ。 code:haskell
class Functor f => Filterable f where
mapMaybe :: (a -> Maybe b) -> f a -> f b
catMaybes :: f (Maybe a) -> f a
filter :: (a -> Bool) -> f a -> f a
class (Traversable t, Filterable t) => Witherable t where
wither :: Applicative f => (a -> f (Maybe b)) -> t a -> f (t b)