Skip to content

Optimise concatenation of empty list?

@AndreasK pointed out some low-hanging optimization fruit for Data.List.(++) in !616 (diffs). Namely, xs ++ [] ends up rebuilding xs. Perhaps we should rather expose,

(++) xs [] = xs
(++) xs ys = go
  where
    go (x:xs) = x : go xs
    go [] = ys

Just a thought.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information