Maintainer bastiaan.heeren@ou.nl provisional portable (depends on ghc) Safe Haskell98

Util.List

Description

Synopsis

# Documentation

safeHead :: [a] -> Maybe a Source #

returnOnJustM :: (Monad m, Show a) => (a -> m (Maybe b)) -> [a] -> m (Maybe (b, [a])) Source #

groupings :: [a] -> [b] -> [[(a, b)]] Source #

cartProd :: [a] -> [b] -> [(a, b)] Source #

selections :: [a] -> [(a, [a])] Source #

safeLast :: [a] -> Maybe a Source #

appLast :: (a -> a) -> [a] -> [a] Source #

modifyAt :: Int -> (a -> a) -> [a] -> [a] Source #

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

Find index of an element in a list.

concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] Source #

Monadic concatMap.

groupBy' :: (a -> a -> Bool) -> [a] -> [[a]] Source #

Alternative to groupBy, where only adjacent elements are compared - so the predicate does not assume transitivity.

orderBy :: Ord b => (a -> b) -> [a] -> [(b, [a])] Source #

Alternative to groupBy, in which the list is sorted and grouped on a certain attribute, and each group is labelled with said attribute.