Force single evaluation?

Axel Jantsch axel at
Mon Dec 18 11:09:45 EST 2006


I call a C function from a Haskell program. I am using unsafePerformIO
to use it outside a monad. 

Even though the C function does not have any side effect, I absolutely
don't want to evaluate it more than once for performance reasons. But my
impression is that it is evaluated several times.

1. Can I monitor somehow how often it is evaluated?
2. Can I ensure that the function is evaluated only once?

I am using ghc 6.4.1

I ma grateful for any hint!


Phone: +46 8 790 4124, Email: axel at, Web:


Phone: +46 8 790 4124, Email: axel at, Web:

More information about the FFI mailing list