ddc-core-0.4.3.1: Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe
LanguageHaskell98

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 a Source #

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 a Source #

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

index :: [a] -> Int -> Maybe a Source #

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

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

Find the duplicate values in a list.

stripSuffix :: Eq a => [a] -> [a] -> Maybe [a] Source #

Drops the given suffix from a list.