Fusion of a simple listArray call is very fragile
Consider the following (taken from ticket:11707#comment:117750),
module Test where import Data.Array arr, arr2 :: Array Int Int arr = listArray (0,10) [ 1,1,1,1,1,1,1,1,1,1 ] arr2 = listArray (0,10) [ 1,1,1,1,1,1,1,1,1,-1 ]
Given that these are a small array, one might suspect it would be worthwhile for GHC to fuse the lists with
listArray, giving rise to two nicely unrolled construction procedures.
However, if you look at the Core produced by
-O1 this you'll find that this only happens in the case of
arr on the other handle, is mysteriously not fused. The fact that these expressions are so similar and yet produce entirely different code is quite worrying.