7 Jul 2012 06:06
Imported foreign functions should be strict
Favonia <favonia <at> gmail.com>
2012-07-07 04:06:11 GMT
2012-07-07 04:06:11 GMT
Hi all,
Recently I am tuning one of our incomplete libraries that uses FFI.
After dumping the interface file I realized strictness/demand analysis
failed for imported foreign functions---that is, they are not inferred
to be strict in their arguments. In my naive understanding all
imported foreign functions are strict! Here's a minimum example (with
GHC 7.4.2):
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Foreign.C
foreign import ccall unsafe "sin" sin' :: CDouble -> CDouble
where in the interface file the function sin' will have strictness
U(L) (meaning Unpackable(Lazy)).
Regards,
Favonia
RSS Feed