-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Generalization of catMaybes
--
@package witherable
@version 0.0
module Data.Witherable
-- | Like traverse, but you can remove elements instead of
-- updating them. traverse f = wither (fmap Just . f) Minimal
-- complete definition: wither or catMaybes.
class Traversable t => Witherable t where wither f = fmap catMaybes . traverse f catMaybes = runIdentity . wither pure witherM f = unwrapMonad . wither (WrapMonad . f)
wither :: (Witherable t, Applicative f) => (a -> f (Maybe b)) -> t a -> f (t b)
catMaybes :: (Witherable t, Witherable t) => t (Maybe a) -> t a
witherM :: (Witherable t, Monad m) => (a -> m (Maybe b)) -> t a -> m (t b)
-- | blightM is witherM with its arguments flipped.
blightM :: (Monad m, Witherable t) => t a -> (a -> m (Maybe b)) -> m (t b)
instance Witherable Seq
instance Witherable Vector
instance Witherable (Const r)
instance (Eq k, Hashable k) => Witherable (HashMap k)
instance Ord k => Witherable (Map k)
instance Witherable IntMap
instance Witherable []
instance Witherable Maybe