isort :: Ord a => [a] -> [a] isort = foldr insert [] where insert n [] = [n] insert n (x:xs) = if n<=x then n: x: xs else x: insert n xs