Also known as bogosort.
import Data.List (permutations)
sorted :: Ord a => [a] -> Bool
sorted (x:y:xs) = x <= y && sorted (y:xs)
sorted _ = True
psort :: Ord a => [a] -> [a]
psort = head . filter sorted . permutations
Extremely inefficient (on today's computers).