fork download
  1. bubblesort xs
  2. | xs == xs' = xs'
  3. | otherwise = bubblesort xs'
  4. where
  5. xs' = bubblesortIterate xs
  6. bubblesortIterate lst@(x:xs)
  7. | nil . xs = xs
  8. | x <= head xs = x:bubblesortIterate xs
  9. | otherwise = bubblesortSwap lst
  10. bubblesortSwap x:y:xs = y:x:xs
  11.  
  12. bubblesort [4,2,40,0,13,10]
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:10:2: Parse error in pattern
stdout
Standard output is empty