如果使用Haskell作为从我的C程序调用的库,那么调用它会对性能产生什么影响?例如,如果我有一个20kB数据的问题世界数据集,我想运行如下:
// Go through my 1000 actors and have them make a decision based on
// HaskellCode() function, which is compiled Haskell I'm accessing through
// the FFI. As an argument, send in the SAME 20kB of data to EACH of these
// function calls, and some actor specific data
// The 20kB constant data defines the environment and the actor specific
// data could be their personality or state
for(i = 0; i < 1000; …
Run Code Online (Sandbox Code Playgroud) 我能够通过包含标准数据类型的FFI导出简单的haskell函数.但是,我不知道如何导出采用标准数据类型以外的数据类型的函数.
例如
data SomeType a = SomeType a
data SomeOtherType b = SomeOtherType b
doSomething:: SomeType a -> SomeOtherType b
Run Code Online (Sandbox Code Playgroud)
如何导出函数doSomething?
现有文件谈到了非常简单的例子.