@sig(H[(Eq, "a")]/ "a" >> ["a"] >> t(Maybe, int))
def elemIndex(x, xs):
    """
    elemIndex :: Eq a => a -> [a] -> Maybe Int

    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 i, a in enumerate(xs):
        if a == x:
            return Just(i)
    return Nothing
dataset/ETHPy150Open billpmurphy/hask/hask/Data/List.py/elemIndex/original