I\'m trying to do this from scratch, without the use of a library outside the standard lib. Heres my code:
permutations :: [a] -> [[a]] permutations (x:xs
It's already in the standard base library, so no need to struggle. If you really want to see how to do it, you can look at the source of that library.