:: a -> [a] -> Int package:xmonad-contrib

The elemIndex function returns the index of the first element in the given list which is equal (by ==) to the query element, or Nothing if there is no such element. For the result to be Nothing, the list must be finite.

Examples

>>> elemIndex 4 [0..]
Just 4
>>> elemIndex 'o' "haskell"
Nothing
>>> elemIndex 0 [1..]
* hangs forever *