combineIdenticalAlts is only partially implemented
combineIdenticalAlts commons up branches of case expressions which have the same RHS.
However, it is not fully implemented so opportunities to common up branches are missed. For very big case expressions in might impact compilation time but it could be something which is enabled by
For example, the
D case for
foo are not commened up but the
B case in
module Foo where data T = A | B | C | D foo x = case x of A -> 0 B -> 1 C -> 2 D -> 2 foo2 x = case x of A -> 2 B -> 2 C -> 0 D -> 1
See also #18377 for another version of this same issue.