typechecker: Made sort only work on lists