Skip to content

FFI function pointers with unlifted argument types

Motivation

I noticed today that GHC disallows using the function pointer wrapper facilities when the function in question has any unlifted arguments. For example:

type KafkaLog = Addr# -> Int# -> Addr# -> Addr# -> IO ()
foreign import ccall "wrapper"
  mkCompare :: KafkaLog -> IO (FunPtr KafkaLog)

Turning on UnliftedFFITypes does not address the problem

Proposal

Allow unlifted types to show up as arguments to wrapped functions when UnliftedFFITypes is enabled.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information