
2 Jun
2013
2 Jun
'13
9:15 a.m.
Right, these optimizations are done on the unboxed level, where bottom is
not a concern. GHC would transform
bar a b = a + b - a - b
to
bar (I# a) (I# b) = I# (a +# b -# a -# b)
whose RHS could be optimized away to I# 0#. bar is still strict in its two
arguments, so calling bar undefined undefined would still throw an error.
On Sun, Jun 2, 2013 at 7:24 AM, Boris Lykah
It is not obvious that semantics is preserved for optimisations which remove non-constants like
bar a b = a + b - a - b -- the RHS is should be optimized away to 0
Calling bar undefined undefined throws an error, but the optimised bar would return 0.
-- Regards, Boris