Saturday, February 1, 2014

Haskell Error 3


quicksort.hs:6:42:
    Unexpected parallel statement in a list comprehension
    Use -XParallelListComp

quicksort.hs:6:44: Not in scope: `a'

I placed '|' (pipeline) instead of a ',' (comma) to separate predicate section. Program with Error:
quicksort :: (Ord a) => [a] -> [a] 
quicksort [] = []
quicksort(x:xs)=let smallerSorted = quicksort [a | a <- xs, a <= x]
                    biggerSorted = quicksort [a | a <- xs| a > x] 
--But it supposed to be "a <- xs, a > x"
in smallerSorted ++ [x] ++ biggerSorted


No comments:

Post a Comment