combinators-0.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.

Traversal

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

Indexed version of forM.