I am able to export simple haskell functions through FFI containing standard data types. However, I do not know how to export a function that takes data type other than standard data types.
E.g.
data SomeType a = SomeType a
data SomeOtherType b = SomeOtherType b
doSomething:: SomeType a -> SomeOtherType b
How can I export function doSomething?
The existing documents talks about very simple examples.
Short answer is, you can’t.
You need to pick an instance of the function and export that.
e.g.
doSomething :: SomeType Int -> SomeOtherType Intis exportable. I wrote a longer answer here that might be helpfulThe reason is that the Haskell side needs to know how to marshall the structure, how much memory to allocate etc.