Home > Software design >  this is a Haskell program for quick sort,
this is a Haskell program for quick sort,

Time:11-03

but I get lot of error in it.enter image description here

I could not understand where there problem is, is it the a

CodePudding user response:

Whatever weird left-arrow character you're using, it isn't one GHC understands. Just write <- like it's the '90s again.

CodePudding user response:

You can enable the left arrow (←) by enabling the UnicodeSyntax extension [ghc-doc]:

{-# LANGUAGE UnicodeSyntax #-}

qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = smaller    x : larger
    where
      smaller = [ a | a ← xs, a <= x ]
      larger = [ a | a ← xs, a > x ]

you can transform additional arrows with:

{-# LANGUAGE UnicodeSyntax #-}

qsort ∷ Ord a ⇒ [a] → [a]
qsort [] = []
qsort (x:xs) = smaller    x : larger
    where
      smaller = [ a | a ← xs, a <= x ]
      larger = [ a | a ← xs, a > x ]
  • Related