Full-precision summation in Haskell
You could write hilo as hilo :: Double -&gt; Double -&gt; [Double], which returns [hi,lo] for lo /= 0 and [hi] for lo = 0. Then you can write partials as

partials x = foldl' (\acc p -&gt; (hilo x p) ++ acc) -&gt; hi:acc []


BTW: How could lo ever become non-zero considering

lo = y - (hi - x) = y - (x + y - x) = y - y = 0


Rounding?