[Haskell-cafe] Two GHC-related GSoC Proposals

Patrick Palka patrick at parcs.ath.cx
Sun Jun 2 15:15:59 CEST 2013


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 <lykahb at gmail.com> wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130602/f54d5fd6/attachment.htm>


More information about the Haskell-Cafe mailing list