[Haskell-cafe] type inference and FFI

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Wed Oct 27 09:18:42 UTC 2021


Hello, I have a bunch of C method that I need to call like this

c'foo_unit16_t :: Ptr Word16 -> IO r
c'foo_uint32_t :: Ptr Word32 -> IO r
...

These methodes are called from a method like this


process :: NativeType t => Dataframe t => IO r
process df = do
   ...
   <pseudo code>
   case typeof t of
       WORD16 -> c'foo_unit16_t ...
       WORD32 -> c'foo_uint32_t ...

Since there is type erasure, I would like to know what is the best way to write this process method.

thanks for you help

Frederic


More information about the Haskell-Cafe mailing list