
23 Mar
2009
23 Mar
'09
7:16 p.m.
I just noticed that GHC (6.11.20090320) seems to compile both f (a:b:c) = f (a:[]) = f [] = and f [] = f (a:[]) = f (a:b:c) = to something like (looking at Core, but writing source) f x = case x of { [] -> ..; (a:t) -> case t of { [] ->..; (b:c) ->..}} That doesn't seem right to me: if I try to give the patterns in the order from frequent to rare, in order to reduce jumps, I don't expect GHC to rearrange things. What is the rationale for this? And where can I read about GHC's pattern match compilation approach in general? Claus