Generalize list eliminator

Generalize the list eliminator to return any type, rather than only the type of the elements in the list. This matches the behavior of other eliminators, such as maybe and either.