Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Traversable t => Witherable t where
- wither :: Applicative f => (a -> f (Maybe b)) -> t a -> f (t b)
- catMaybes :: Witherable t => t (Maybe a) -> t a
- witherM :: Monad m => (a -> MaybeT m b) -> t a -> m (t b)
- blightM :: (Monad m, Witherable t) => t a -> (a -> MaybeT m b) -> m (t b)
Documentation
class Traversable t => Witherable t where Source
Like traverse
, but you can remove elements instead of updating them.
traverse f = wither (fmap Just . f)
Minimal complete definition: wither
or catMaybes
.
Nothing
wither :: Applicative f => (a -> f (Maybe b)) -> t a -> f (t b) Source
catMaybes :: Witherable t => t (Maybe a) -> t a Source
witherM :: Monad m => (a -> MaybeT m b) -> t a -> m (t b) Source
Witherable [] | |
Witherable Maybe | |
Witherable IntMap | |
Witherable Seq | |
Witherable Vector | |
Witherable (Const r) | |
Ord k => Witherable (Map k) | |
(Eq k, Hashable k) => Witherable (HashMap k) |