planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

List.Partial

Synopsis

Documentation

(!!) :: [a] -> Int -> a infixl 9 #

List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.

chunksOf :: Partial => Int -> [a] -> [[a]] #

Split a list into chunks of a given size. The last chunk may contain fewer than n elements. The chunk size must be positive.

chunksOf 3 "my test" == ["my ","tes","t"]
chunksOf 3 "mytest"  == ["myt","est"]
chunksOf 8 ""        == []
chunksOf 0 "test"    == undefined

elemIndexJust :: (Partial, Eq a) => a -> [a] -> Int #

elemIndexJust op = fromJust . elemIndex op

findIndexJust :: (a -> Bool) -> [a] -> Int #

findIndexJust op = fromJust . findIndex op

findJust :: (a -> Bool) -> [a] -> a #

findJust op = fromJust . find op

head :: [a] -> a #

Extract the first element of a list, which must be non-empty.

init :: [a] -> [a] #

Return all the elements of a list except the last one. The list must be non-empty.

last :: [a] -> a #

Extract the last element of a list, which must be finite and non-empty.

lookupJust :: (Eq a, Partial) => a -> [(a, b)] -> b #

lookupJust key = fromJust . lookup key

tail :: [a] -> [a] #

Extract the elements after the head of a list, which must be non-empty.