i have this code:
qs [] = []
qs [x] = [x]
qs (x:xs) = qs [a | a <- xs, a < x] ++ [x] ++ qs [b | b <- xs, b >= x]
when i save it to some file .hs
and load it to ghci
i can execute qs
with a list of numbers without a problem.
but in Org-mode it give me error: *** Exception: <interactive>:16:1-56: Non-exhaustive patterns in function qs
the code block looks like this:
#+BEGIN_SRC haskell
qs [] = []
qs [x] = [x]
qs (x:xs) = qs [a | a <- xs, a < x] ++ [x] ++ qs [b | b <- xs, b >= x]
qs [2,9,3,8,4,7,5,6]
#+END_SRC
it's the same code as in the .hs
file except the last line that execute an actual qs
function.
how can i successfully execute this block?