mapUFM was strict in the structure of the tree, perhaps accidentally.
In any case, this interacted badly with the use of mapVarEnv in
SimplEnv.mkCoreSubst, which assumed that the map was lazy.
mapUFM is now lazy in the structure of the tree, which matches the
behaviour of FiniteMap.mapFM.
This fixes some long compilation times, in particular HTMLMonad98.hs
from WASH used to take 2 mins to compile without optimisation, now
takes less than 20 seconds.
\begin{code}
map_tree f (NodeUFM j p t1 t2)
- = mkSSNodeUFM (NodeUFMData j p) (map_tree f t1) (map_tree f t2)
+ = mkLLNodeUFM (NodeUFMData j p) (map_tree f t1) (map_tree f t2)
+ -- NB. lazy! we know the tree is well-formed.
map_tree f (LeafUFM i obj)
= mkLeafUFM i (f obj)
-
map_tree f _ = panic "map_tree failed"
\end{code}