manatee-core-0.0.1: The core of Manatee.

Manatee.Toolkit.General.List

Synopsis

# Documentation

(?!) :: [a] -> Int -> Maybe aSource

Return element of list with given index.

intersectEnd :: Ord a => [a] -> [a] -> [a]Source

Intersect element with list from end, don't including front or middle element. Return null if haven't intersection element.

intersectFront :: Ord a => [a] -> [a] -> [a]Source

Intersect element with list from front, don't including end or middle element. Return null if haven't intersection element.

delay :: Int -> [a] -> [Int]Source

Delay list with given start index.

listIndex :: [a] -> [Int]Source

Index of list

pairPred :: [a] -> [(a, Int)]Source

Pair with list index.

different :: Ord a => [a] -> [a] -> [a]Source

Different two list, and two lists must have same length. otherwise throw a error.

unlessNull :: [a] -> IO () -> IO ()Source

Do action when list not empty.

has :: [a] -> BoolSource

not . null

lastM :: Monad m => m [a] -> m aSource

concatM :: Monad m => m [a] -> m [a] -> m [a]Source

ConcatM.

replaceAt :: Int -> [a] -> a -> [a]Source

Replace n'th element (count from 0) in `xs` to `x`

splitWith :: (a -> Bool) -> [a] -> [[a]]Source

Split list with given condition.

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

concatMapM.

findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)Source

Like find, but works with monadic computation instead of pure function. In expression `find FUNCTION list`, if FUNCTION is IO Bool, you can use `findM FUNCTION list` to instead.

apply2M :: Monad m => [a] -> (a -> m b) -> (a -> m c) -> m [(b, c)]Source

Apply two monad function with list. And return new monad tuples list.

apply2 :: [a] -> (a -> b) -> (a -> c) -> [(b, c)]Source

Apply two function with list. And return new tuples list.

partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a])Source

Partition list.

findNext :: (a -> Bool) -> [a] -> Maybe aSource

Like `init`, but accept empty list.

Like `foldl1`, but accept empty list.

Find next element.

findNextCycle :: (a -> Bool) -> [a] -> Maybe aSource

Find next cycle.

findPrevCycle :: (a -> Bool) -> [a] -> Maybe aSource

Find previous cycle.

deleteAt :: Int -> [a] -> [a]Source

Delete at.

getLast :: [a] -> Maybe aSource

Get last one.

getFirst :: [a] -> Maybe aSource

Get first one.

zipWithIndex :: [a] -> (a -> Int -> c) -> [c]Source

Zip with list index.

zipWithIndexM :: Monad m => [a] -> (a -> Int -> m c) -> m [c]Source

Zip with list index.

zipWithIndexM_ :: Monad m => [a] -> (a -> Int -> m c) -> m ()Source

Zip with list index.

addMap :: ([a] -> [a]) -> [[a]] -> [a]Source

Like `concatMap`, but don't concat last one.

insertUnique :: Ord a => a -> [a] -> [a]Source

Like `insert` but just insert unique element.