How to export a function from haskell containing data types via FFI

I can export simple haskell functions through FFI containing standard data types. However, I do not know how to export a function that uses a data type other than standard data types.

eg.

data SomeType a = SomeType a
data SomeOtherType b = SomeOtherType b

doSomething:: SomeType a -> SomeOtherType b

How can I export the doSomething function?

Existing documents speak of very simple examples.

+5
source share
2 answers

Short answer: you cannot .

You need to select an instance of the function and export it.

eg. doSomething :: SomeType Int -> SomeOtherType Intexported. I wrote a longer answer here that may be useful

, Haskell , , ..

+1

StablePtr StablePtr. , , , .

- H/Direct, ++, .

+2

All Articles