{-

interleave 1 [4]
= (1:4:[]) : map (4:) interleave 1 []
= (1:4:[]) : map (4:) [[1]]
= (1:4:[]) : [[4,1]]
= [1,4] : [[4,1]]
= [[1,4],[4,1]]

interleave 1 [3,4]
= (1:3:[4]) : map (3:) interleave 1 [4]
= (1:3:[4]) : map (3:) [[1,4],[4,1]]
= (1:3:[4]) : [[3,1,4],[3,4,1]]
= [[1,3,4],[3,1,4],[3,4,1]]

interleave 1 [2,3,4]
= (1:2:[3,4]) : map (2:) (interleave 1 ys)  
= [1,2,3,4] : map (2:) interleave 1 [3,4]  
= [1,2,3,4] : map (2:) [[1,3,4],[3,1,4],[3,4,1]]  
= [1,2,3,4] : [[2,1,3,4],[2,3,1,4],[2,3,4,1]]  
= [[1,2,3,4],[2,1,3,4],[2,3,1,4],[2,3,4,1]]  

-}

perms :: [a] -> [[a]]
perms [] = [[]]
perms :: [a] -> [[a]]
perms [] = [[]]
perms [] = [[]]