Skip to content

Instantly share code, notes, and snippets.

@KPCCoiL
Created June 21, 2015 05:31
Show Gist options
  • Save KPCCoiL/45e74f4ae6d3fde612fe to your computer and use it in GitHub Desktop.
Save KPCCoiL/45e74f4ae6d3fde612fe to your computer and use it in GitHub Desktop.
module Main
qsort : Ord a => List a -> List a
qsort [] = []
qsort (x :: xs) = smaller ++ [x] ++ larger
where smaller = qsort [y | y <- xs, y <= x]
larger = qsort [y | y <- xs, y > x]
main : IO ()
main = printLn $ qsort [5, 1, 5, 89, 1, 8, 5, 78]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment