:: [a] -> Int -> Maybe a -package:rio -package:vector

A total variant of the list index function (!!).
[2,3,4] !? 1    == Just 3
[2,3,4] !? (-1) == Nothing
[]      !? 0    == Nothing
Safer version of !!, returns a Maybe. Get element from list using index value starting from `0`.
>>> [] !!? 0
Nothing
>>> ["a", "b", "c"] !!? 3
Nothing
>>> [1, 2, 3] !!? (-1)
Nothing
>>> ["a", "b", "c"] !!? 2
Just "c"
Lookup function (safe). O(min n index).
Safe version of (!!).
Array indexing with negative values allowed
A (!!) that fails using mzero
!!? with its arguments flipped. Get element from list using index value starting from `0`.
>>> maybeAt 0 []
Nothing
>>> maybeAt 3 ["a", "b", "c"]
Nothing
>>> maybeAt (-1) [1, 2, 3]
Nothing
>>> maybeAt 2 ["a", "b", "c"]
Just "c"
Deprecated: Use XMonad.Prelude.(!?) instead.
Safer version of !! -
>>> fromReverseListN 3 [1,2,3] :: Data.Vector.Vector Int
[3,2,1]