fork download
  1. sort :: Ord a => [a] -> [a]
  2.  
  3. sort [] = []
  4. sort [x] = [x]
  5. sort xs = merge (sort ys) (sort zs)
  6. where
  7. (ys,zs) = splitAt (length xs `div` 2) xs
  8. merge [] y=y
  9. merge x []=x
  10. merge (x:xs) (y:ys)
  11. | x <= y = x:merge xs (y:ys)
  12. | otherwise = y:merge (x:xs) ys
  13.  
  14. sort (15,20,31,39, 40, 43, 50)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:8:17: parse error on input `='
stdout
Standard output is empty