data-extra-2.1.0: Extra utilities for working on Data.* types.

Safe HaskellSafe-Inferred

Data.List.Extra

Description

Extra functions for dealing with lists.

Synopsis

Documentation

list :: b -> ([a] -> b) -> [a] -> bSource

When a list is non-null, pass it to a function, otherwise use the default.

unionOf :: Eq a => [[a]] -> [a]Source

Get the union of the given lists.

for :: [a] -> (a -> b) -> [b]Source

Opposite of map.

lastToMaybe :: [a] -> Maybe aSource

Maybe get the last element in the list.

firstOr :: a -> [a] -> aSource

Return the first item of a list or something else.

maxList :: (Num t, Ord t) => [t] -> tSource

Get the maximum of a list or return zero.