ddc-base-0.4.1.3: Disciplined Disciple Compiler common utilities.

Safe HaskellSafe-Inferred

DDC.Data.ListUtils

Description

Replacements for unhelpful Haskell list functions. If the standard versions are passed an empty list then we don't get a proper source location.

Synopsis

Documentation

takeHead :: [a] -> Maybe aSource

Take the head of a list, or Nothing if it's empty.

takeTail :: [a] -> Maybe [a]Source

Take the tail of a list, or Nothing if it's empty.

takeInit :: [a] -> Maybe [a]Source

Take the init of a list, or Nothing if it's empty.

takeMaximum :: Ord a => [a] -> Maybe aSource

Take the maximum of a list, or Nothing if it's empty.

index :: [a] -> Int -> Maybe aSource

Retrieve the element at the given index, or `Nothing if it's not there.

findDuplicates :: Ord n => [n] -> [n]Source

Fine the duplicate values in a list.