No title

1
2
3
4
5
6
7
8
9
10
11
12
13
-- We make a singleton list and pass it on.
bumergesort :: Ord a => [a] -> [a]
bumergesort = merged . mergesort' . map (:[])

-- recurse until list length is 1
merged (a : []) = a
merged l = merged $ mergesort' l

-- merge pairs of lists
mergesort' :: Ord a => [[a]] -> [[a]]
mergesort' (a : []) = [a]
mergesort' (a : b : []) = merge a b : []
mergesort' (a : b : xs) = merge a b : mergesort' xs
6:8: Warning: Use list literal pattern
Found:
(a : [])
Why not:
[a]
11:12: Warning: Use list literal pattern
Found:
(a : [])
Why not:
[a]
12:12: Warning: Use list literal pattern
Found:
(a : (b : []))
Why not:
[a, b]
12:27: Warning: Use list literal
Found:
merge a b : []
Why not:
[merge a b]