gpt4 book ai didi

haskell - 哪些编译器支持 Haskell FFI

转载 作者:行者123 更新时间:2023-12-04 04:55:45 26 4
gpt4 key购买 nike

除了 ghc 之外,还有其他编译器支持 The Haskell 98 Foreign Function Interface 1.0An Addendum to the Haskell 98 Report 中的 Haskell 外部函数接口(interface)吗? ?

最佳答案

nhc98声明它支持 ffi :

The nhc98 compiler contains an implementation of the standard foreign function interface that is also available in Hugs and ghc. The most recent released version of nhc98 implements the latest standard syntax for foreign function declarations, as specified at: http://www.cse.unsw.edu.au/~chak/haskell/ffi/


我不确定是否

Compliance notes

  • Supported calling conventions are: ccall, noproto, and cast. (The latter two are non-standard, see below.) Unsupported calling conventions are: stdcall, jvm, dotnet, cplusplus.
  • foreign import "wrapper" is not yet supported.
  • The annotation unsafe has no special meaning in nhc98; it is purely a speed optimisation for ghc.
  • A foreign export specification is treated as the actual type signature for the exported function. You are not allowed a second (possibly more general) type signature.
  • Hence, you cannot foreign export any function that requires a class dictionary.

意味着支持只是部分的,或者这些是否是可选的东西,但 nhc98 是,据我所知,除了 GHC 之外,唯一一个至少支持大部分 FFI 规范的编译器。 (hugs 不是编译器,而是解释器,它支持 [大部分] FFI 规范,就像 hugs 开发结束 [2006] 时那样。)
但是请注意,nhc98 也不再得到太多维护。
在积极维护的实现中, jhc , 和 UHC只支持一小部分FFI(原始国外进口),根据各自的主页,所以GHC基本没有竞争。

关于haskell - 哪些编译器支持 Haskell FFI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16774496/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com