| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
RIO.List.Partial
Description
List partial functions. Import as:
import qualified RIO.List.Partial as L'
Synopsis
- head :: [a] -> a
 - last :: [a] -> a
 - tail :: [a] -> [a]
 - init :: [a] -> [a]
 - foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
 - foldl1' :: (a -> a -> a) -> [a] -> a
 - foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
 - maximum :: (Foldable t, Ord a) => t a -> a
 - minimum :: (Foldable t, Ord a) => t a -> a
 - maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
 - minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
 - scanl1 :: (a -> a -> a) -> [a] -> [a]
 - scanr1 :: (a -> a -> a) -> [a] -> [a]
 - (!!) :: [a] -> Int -> a
 
Basic functions
\(\mathcal{O}(n)\). Extract the last element of a list, which must be finite and non-empty.
\(\mathcal{O}(1)\). Extract the elements after the head of a list, which must be non-empty.
\(\mathcal{O}(n)\). Return all the elements of a list except the last one. The list must be non-empty.
Reducing lists (folds)
Special folds
maximum :: (Foldable t, Ord a) => t a -> a #
The largest element of a non-empty structure.
Since: base-4.8.0.0
minimum :: (Foldable t, Ord a) => t a -> a #
The least element of a non-empty structure.
Since: base-4.8.0.0
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a #
The largest element of a non-empty structure with respect to the given comparison function.
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a #
The least element of a non-empty structure with respect to the given comparison function.
Building lists
Scans
Indexing lists
(!!) :: [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.