combinators-0.1.1: Collection of combinators over standard typeclasses
Safe HaskellSafe-Inferred
LanguageHaskell2010

Combinators

Synopsis

Alternation

alternate :: (Foldable f, Alternative g) => f a -> g a Source #

Generalization over many common natural transformations, including:

  • listToMaybe
  • maybeToList
  • toList
  • either (const Nothing) Just

alternateMap :: (Foldable f, Alternative g) => (a -> b) -> f a -> g b Source #

alternate extended with ability to map the wrapped value.

alternateMapM :: (Foldable f, Alternative g) => (a -> g b) -> f a -> g b Source #

alternateMap extended with ability to do the mapping in the Alternative context.

Folding

intercalate :: (Foldable f, Monoid a) => a -> f a -> a Source #

A generic version of the original list-specialized version:

intercalate :: [a] -> [[a]] -> [a]

intercalateMap :: (Foldable f, Monoid m) => m -> (a -> m) -> f a -> m Source #

intercalate extended with ability to map the wrapped value.

Traversal

iforM :: (Traversable f, Monad m) => f a -> (Int -> a -> m b) -> m (f b) Source #

Indexed version of forM.

itraverse :: (Traversable f, Monad m) => (Int -> a -> m b) -> f a -> m (f b) Source #

Indexed version of traverse.