!!

List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type. WARNING: This function is partial, and should only be used if you are sure that the indexing will not fail. Otherwise, use !?. WARNING: This function takes linear time in the index.

Examples

>>> ['a', 'b', 'c'] !! 0
'a'
>>> ['a', 'b', 'c'] !! 2
'c'
>>> ['a', 'b', 'c'] !! 3
*** Exception: Prelude.!!: index too large
>>> ['a', 'b', 'c'] !! (-1)
*** Exception: Prelude.!!: negative index
xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: a negative or out-of-bounds index will cause an error.
The deep analogue of $!. f $!! x fully evaluates x before returning f x. There is no guarantee about the ordering of evaluation. f x may be evaluated before x is fully evaluated. To impose an actual order on evaluation, use pseq from Control.Parallel in the parallel package.
Deeply strict version of <$>.