:: [a] -> Int -> Maybe a package:ghc-internal

List index (subscript) operator, starting from 0. Returns Nothing if the index is out of bounds This is the total variant of the partial !! operator. WARNING: This function takes linear time in the index.

Examples

>>> ['a', 'b', 'c'] !? 0
Just 'a'
>>> ['a', 'b', 'c'] !? 2
Just 'c'
>>> ['a', 'b', 'c'] !? 3
Nothing
>>> ['a', 'b', 'c'] !? (-1)
Nothing