Prevent optimization from tempering with unsafePerformIO

Neil Mitchell ndmitchell at gmail.com
Mon Oct 15 11:34:53 EDT 2007


Hi Bernd,

> I am writing a compiler from the functional logic language Curry to
> Haskell. As the result is a real extension of Haskell, there has to be
> SOME side effect involved. Unfortunately, this seems to prevent me from
> using any of ghc's optimizations on the resulting code. I have tried for
> some time to invoke the no-inline pragmata, but they seem to have no
> effect at all. Recently at ICFP, Neil Mitchell told me that there
> definitely is a way to avoid this problem. But does anybody know how?

It varies by each piece of code, can you post a code fragment that
gets optimised in the wrong way?

In the particular case I was fighting with previously, GHC was not
inlining the unsafe bit, but was floating out the actual computation
and turning it into a CAF which was being shared.

Thanks

Neil


More information about the Glasgow-haskell-users mailing list