qsort [] = []
qsort (x:xs) = (qsort ys) ++ [x] ++ (qsort zs)
           where 
            ys = [a | a <- xs, a <= x]
            zs = [b | b <- xs, b > x] 

main = do
  putStrLn "Quicksort in Haskell"
  
  let unsorted = [2,4,1,3,5]
  let sorted = qsort unsorted
  
  print $ unsorted
  print $ sorted

Embed on website

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