qsort [] = []
qsort (p:xs) = qsort lt ++ [p] ++ qsort gt
  where (lt, gt) = partition' ((>) p) xs

partition' _ [] = ([], [])
partition' f (x:xs)
  | f x       = (x:accepted, rejected)
  | otherwise = (accepted, x:rejected)
  where (accepted, rejected) = partition' f xs   

main = do
  print $ qsort [3,1,2]
  print $ partition' odd [1,2,3,4,5]

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: