車輪の再発明
perm.hs
module Perm whereperm :: Eq a => [a] -> [[a]]perm [] = [[]]perm xs = flatten [ map (y:) rest | y <- xs, let rest = perm $ filter (/=y) xs ] where flatten :: [[a]] -> [a] flatten xs = foldl (++) [] xs``````bash*Perm> perm "abc"
["abc","acb","bac","bca","cab","cba"]