extra-1.7.16: Extra functions I use.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Foldable.Extra

Synopsis

- module Data.Foldable
- notNull :: Foldable f => f a -> Bool
- sum' :: (Foldable f, Num a) => f a -> a
- product' :: (Foldable f, Num a) => f a -> a
- sumOn' :: (Foldable f, Num b) => (a -> b) -> f a -> b
- productOn' :: (Foldable f, Num b) => (a -> b) -> f a -> b
- anyM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool
- allM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool
- orM :: (Foldable f, Monad m) => f (m Bool) -> m Bool
- andM :: (Foldable f, Monad m) => f (m Bool) -> m Bool
- findM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m (Maybe a)
- firstJustM :: (Foldable f, Monad m) => (a -> m (Maybe b)) -> f a -> m (Maybe b)

# Documentation

module Data.Foldable

notNull :: Foldable f => f a -> Bool Source #

Composition of `not` and `null`

sum' :: (Foldable f, Num a) => f a -> a Source #

A generalization of `sum'` to `Foldable` instances.

product' :: (Foldable f, Num a) => f a -> a Source #

A generalization of `product'` to `Foldable` instances.

sumOn' :: (Foldable f, Num b) => (a -> b) -> f a -> b Source #

A generalization of `sumOn'` to `Foldable` instances.

productOn' :: (Foldable f, Num b) => (a -> b) -> f a -> b Source #

A generalization of `productOn'` to `Foldable` instances.

anyM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool Source #

A generalization of `anyM` to `Foldable` instances. Retains the short-circuiting behaviour.

allM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool Source #

A generalization of `allM` to `Foldable` instances. Retains the short-circuiting behaviour.

orM :: (Foldable f, Monad m) => f (m Bool) -> m Bool Source #

A generalization of `orM` to `Foldable` instances. Retains the short-circuiting behaviour.

andM :: (Foldable f, Monad m) => f (m Bool) -> m Bool Source #

A generalization of `andM` to `Foldable` instances. Retains the short-circuiting behaviour.

findM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m (Maybe a) Source #

A generalization of `findM` to `Foldable` instances.

firstJustM :: (Foldable f, Monad m) => (a -> m (Maybe b)) -> f a -> m (Maybe b) Source #

A generalization of `firstJustM` to `Foldable` instances.