Avoiding CAF's

Neil Mitchell ndmitchell at gmail.com
Wed May 16 05:15:36 EDT 2007


Hi,

I'm trying to avoid CAF's being created, and I was wondering how is
the best way to do it with GHC. For example:

f = ....

Can I attach {-# INLINE #-} to f, and expect the CAF to be removed
that way? Is there any NOCAF annotation. I can always f _, then change
the callers to f () - if I'm doing that what is the most efficient
fake argument, and should I annotate f in any way? If the dummy
argument isn't used, is GHC going to float the let outside and re-CAF
it?

The next example is:

foreign import ccall safe "stdio.h getchar" getchar2 :: CInt

Can I stop this being CAF'd in any way?

I'm working at a very low level here, so any hacky things with big
disclaimers are still appreciated.

Thanks

Neil


More information about the Glasgow-haskell-users mailing list