@@ -0,0 +1,10 @@
3+-- | All permutations of a list.
4+permutations : List a -> List (List a)
6+permutations xs = [y :: zs | (y, ys) <- select xs, zs <- permutations ys]
8+ select : List a -> List (a, List a)
10+ select (x :: xs) = (x, xs) :: [(y, x::ys) | (y,ys) <- select xs]