Force single evaluation?

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


Hello,

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!

Regards,
Axel

-- 
Phone: +46 8 790 4124, Email: axel at kth.se, Web: www.it.kth.se/~axel

-- 

---
Phone: +46 8 790 4124, Email: axel at imit.kth.se, Web: www.imit.kth.se/~axel


More information about the FFI mailing list