-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Class of filtrable containers
--   
--   See Data.Filtrable.
@package filtrable
@version 0.1.6.0

-- | See Filtrable.
module Data.Filtrable

-- | Class of filtrable containers, i.e. containers we can map over while
--   selectively dropping elements.
--   
--   Laws:
--   
--   
--   
- 
mapMaybe Just = id

--   
- 
mapMaybe f = catMaybes ∘ fmap
--   f

--   
- 
catMaybes = mapMaybe id

--   
- 
filter f = mapMaybe (\ x -> bool
--   Nothing (Just x) (f x))

--   
- 
mapMaybe g . mapMaybe f = mapMaybe (g
--   <=< f)

--   
--   
--   Laws if Foldable f:
--   
--   
--   
- 
foldMap g . filter f = foldMap (\ x
--   -> bool mempty (g x) (f x))

--   
class Functor f => Filtrable (f :: Type -> Type)

-- | Map the container with the given function, dropping the elements for
--   which it returns Nothing.
mapMaybe :: Filtrable f => (a -> Maybe b) -> f a -> f b

-- | 
--   catMaybes = mapMaybe id
--   
catMaybes :: Filtrable f => f (Maybe a) -> f a

-- | Drop the elements for which the given predicate is False.
filter :: Filtrable f => (a -> Bool) -> f a -> f a

-- | Traverse the container with the given function, dropping the elements
--   for which it returns Nothing.
mapMaybeA :: (Filtrable f, Traversable f, Applicative p) => (a -> p (Maybe b)) -> f a -> p (f b)

-- | Drop the elements for which the given predicate is False.
filterA :: (Filtrable f, Traversable f, Applicative p) => (a -> p Bool) -> f a -> p (f a)

-- | Map the container with the given function, collecting the Lefts
--   and the Rights separately.
mapEither :: Filtrable f => (a -> Either b c) -> f a -> (f b, f c)

-- | Traverse the container with the given function, collecting the
--   Lefts and the Rights separately.
mapEitherA :: (Filtrable f, Traversable f, Applicative p) => (a -> p (Either b c)) -> f a -> p (f b, f c)

-- | 
--   partitionEithers = mapEither id
--   
partitionEithers :: Filtrable f => f (Either a b) -> (f a, f b)

-- | Infix synonym of mapMaybe
(<$?>) :: Filtrable f => (a -> Maybe b) -> f a -> f b
infixl 4 <$?>

-- | 
--   f <*?> a = catMaybes (f <*> a)
--   
(<*?>) :: (Applicative p, Filtrable p) => p (a -> Maybe b) -> p a -> p b
infixl 4 <*?>

-- | <math> Delete all but the first copy of each element, special
--   case of nubBy.
nub :: (Filtrable f, Traversable f, Eq a) => f a -> f a

-- | <math> Delete all but the first copy of each element, with the
--   given relation.
nubBy :: (Filtrable f, Traversable f) => (a -> a -> Bool) -> f a -> f a

-- | <math> Delete all but the first copy of each element, special
--   case of nubOrdBy.
nubOrd :: (Filtrable f, Traversable f, Ord a) => f a -> f a

-- | <math> Delete all but the first copy of each element, with the
--   given relation.
nubOrdBy :: (Filtrable f, Traversable f) => (a -> a -> Ordering) -> f a -> f a
instance Data.Filtrable.Filtrable f => Data.Filtrable.Filtrable (Control.Applicative.Backwards.Backwards f)
instance (GHC.Internal.Base.Functor f, Data.Filtrable.Filtrable g) => Data.Filtrable.Filtrable (Data.Functor.Compose.Compose f g)
instance Data.Filtrable.Filtrable (GHC.Internal.Data.Functor.Const.Const a)
instance Data.Filtrable.Filtrable Data.IntMap.Internal.IntMap
instance Data.Filtrable.Filtrable []
instance GHC.Classes.Ord k => Data.Filtrable.Filtrable (Data.Map.Internal.Map k)
instance Data.Filtrable.Filtrable GHC.Internal.Maybe.Maybe
instance (Data.Filtrable.Filtrable f, Data.Filtrable.Filtrable g) => Data.Filtrable.Filtrable (Data.Functor.Product.Product f g)
instance Data.Filtrable.Filtrable GHC.Internal.Data.Proxy.Proxy
instance Data.Filtrable.Filtrable f => Data.Filtrable.Filtrable (Data.Functor.Reverse.Reverse f)
instance Data.Filtrable.Filtrable Data.Sequence.Internal.Seq
instance (Data.Filtrable.Filtrable f, Data.Filtrable.Filtrable g) => Data.Filtrable.Filtrable (Data.Functor.Sum.Sum f g)
