Safe Haskell | Unsafe |
---|---|
Language | Haskell2010 |
Unsafe functions to work with lists and Maybe
.
Sometimes unavoidable but better don't use them. This module
is intended to be imported qualified and it's not even included
in default prelude exports.
import qualified Universum.Unsafe as Unsafe foo :: [a] -> a foo = Unsafe.head
Synopsis
- head :: [a] -> a
- tail :: [a] -> [a]
- init :: [a] -> [a]
- last :: [a] -> a
- at :: Int -> [a] -> a
- (!!) :: [a] -> Int -> a
- fromJust :: HasCallStack => Maybe a -> a
- foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- minimum :: (Foldable t, Ord a) => t a -> a
- maximum :: (Foldable t, Ord a) => t a -> a
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
Documentation
\(\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.
\(\mathcal{O}(n)\). Extract the last element of a list, which must be finite and non-empty.
(!!) :: [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.
fromJust :: HasCallStack => Maybe a -> a #
minimum :: (Foldable t, Ord a) => t a -> a #
The least element of a non-empty structure.
Since: base-4.8.0.0
maximum :: (Foldable t, Ord a) => t a -> a #
The largest element of a non-empty structure.
Since: base-4.8.0.0