ListLike-4.1.0: Generic support for list-like structures

Portabilityportable
Stabilityprovisional
MaintainerJohn Lato <jwlato@gmail.com>
Safe HaskellSafe-Inferred

Data.ListLike.Utils

Description

Utilities for ListLike and friends. More functions similar to List but not part of the main typeclass.

Written by John Goerzen, jgoerzen@complete.org

Synopsis

Documentation

and :: ListLike full Bool => full -> BoolSource

Returns True if all elements are True

or :: ListLike full Bool => full -> BoolSource

Returns True if any element is True

sum :: (Num a, ListLike full a) => full -> aSource

The sum of the list

product :: (Num a, ListLike full a) => full -> aSource

The product of the list

zip :: (ListLike full item, ListLike fullb itemb, ListLike result (item, itemb)) => full -> fullb -> resultSource

Takes two lists and returns a list of corresponding pairs.

zipWith :: (ListLike full item, ListLike fullb itemb, ListLike result resultitem) => (item -> itemb -> resultitem) -> full -> fullb -> resultSource

Takes two lists and combines them with a custom combining function

unzip :: (ListLike full (itema, itemb), ListLike ra itema, ListLike rb itemb) => full -> (ra, rb)Source

Converts a list of pairs into two separate lists of elements

sequence_ :: (Monad m, FoldableLL full (m item)) => full -> m ()Source

Evaluate each action, ignoring the results. Same as mapM_ id.

toMonadPlus :: (MonadPlus m, ListLike full a) => full -> m (a, full)Source

Converts to a MonadPlus instance

list :: ListLike full a => b -> (a -> full -> b) -> full -> bSource

List-like destructor (like Data.Maybe.maybe)