Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class Functor f => Filtrable f where
- mapMaybe :: (a -> Maybe b) -> f a -> f b
- catMaybes :: f (Maybe a) -> f a
- filter :: (a -> Bool) -> f a -> f a
- mapMaybeA :: (Traversable f, Applicative p) => (a -> p (Maybe b)) -> f a -> p (f b)
- filterA :: (Traversable f, Applicative p) => (a -> p Bool) -> f a -> p (f a)
- mapEither :: (a -> Either b c) -> f a -> (f b, f c)
- mapEitherA :: (Traversable f, Applicative p) => (a -> p (Either b c)) -> f a -> p (f b, f c)
- partitionEithers :: f (Either a b) -> (f a, f b)
- (<$?>) :: Filtrable f => (a -> Maybe b) -> f a -> f b
- (<*?>) :: (Applicative p, Filtrable p) => p (a -> Maybe b) -> p a -> p b
Documentation
class Functor f => Filtrable f where Source #
Laws:
mapMaybe
Just
= idmapMaybe
f =catMaybes
∘fmap
fcatMaybes
=mapMaybe
idfilter
f =mapMaybe
(\ x ->bool
Nothing
(Just
x) (f x))mapMaybe
g .mapMaybe
f =mapMaybe
(g<=<
f)
Laws if
:Foldable
f
mapMaybe :: (a -> Maybe b) -> f a -> f b Source #
catMaybes :: f (Maybe a) -> f a Source #
filter :: (a -> Bool) -> f a -> f a Source #
mapMaybeA :: (Traversable f, Applicative p) => (a -> p (Maybe b)) -> f a -> p (f b) Source #
filterA :: (Traversable f, Applicative p) => (a -> p Bool) -> f a -> p (f a) Source #
mapEither :: (a -> Either b c) -> f a -> (f b, f c) Source #
mapEitherA :: (Traversable f, Applicative p) => (a -> p (Either b c)) -> f a -> p (f b, f c) Source #
partitionEithers :: f (Either a b) -> (f a, f b) Source #