I have a C function that I want to expose to Haskell via FFI that takes three strings:
c_fun :: CString -> CString -> CString -> IO ()
How can I use useAsCString
from Data.ByteString
to pass 3 ByteString
s from Haskell? I.e. I'm looking for a implementation of the following:
haskellFun :: ByteString -> ByteString -> ByteString -> IO ()
useAsCString
has type ByteString -> (CString -> IO a) -> IO a
, so it's clear how to use it with a function that accepts one CString
but I can't figure out how to put it together with three.