@sig(H/ ["a"] >> [["a"]])
def inits(xs):
    """
    inits :: [a] -> [[a]]

    The inits function returns all initial segments of the argument, shortest
    first.
    """
    if null(xs):
        return L[[xs]]
    return L[[L[[]]]] + L[(xs[:n+1] for n,_ in enumerate(xs))]
dataset/ETHPy150Open billpmurphy/hask/hask/Data/List.py/inits/original