mono-foldable-0.1.0.0: Folds for monomorphic containers

Safe HaskellNone

Data.Foldable.Mono

Synopsis

Documentation

class MFoldable t whereSource

Monomorphic data structures that can be folded Minimal complete definition: foldMap or foldr

Associated Types

type Elem t :: *Source

Methods

foldMap :: Monoid m => (Elem t -> m) -> t -> mSource

Map each element to a monoid and combine the results

foldl :: (a -> Elem t -> a) -> a -> t -> aSource

Left-associative fold

foldl' :: (a -> Elem t -> a) -> a -> t -> aSource

Strict version of foldl.

foldl1 :: (Elem t -> Elem t -> Elem t) -> t -> Elem tSource

A variant of foldl with no base case. Requires at least 1 list element.

foldr :: (Elem t -> b -> b) -> b -> t -> bSource

Right-associative fold

foldr' :: (Elem t -> b -> b) -> b -> t -> bSource

Strict version of foldr

foldr1 :: (Elem t -> Elem t -> Elem t) -> t -> Elem tSource

Like foldr, but with no starting value

foldM :: (Monad m, MFoldable t) => (a -> Elem t -> m a) -> a -> t -> m aSource

Monadic left fold

mapM_ :: (MFoldable t, Monad m) => (Elem t -> m b) -> t -> m ()Source

Monadic map, discarding results