Question

Are there any other compilers than ghc that support the Haskell Foreign Function Interface as in The Haskell 98 Foreign Function Interface 1.0 An Addendum to the Haskell 98 Report?

Was it helpful?

Solution

nhc98 states that it supports the 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/

I'm not sure whether

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.

means that the support is only partial, or whether these are optional things, but nhc98 is, as far as I know the only compiler except GHC that supports at least a large chunk of the FFI spec. (hugs is not a compiler but an interpreter, it supported [much of] the FFI spec as that was when hugs development ended [2006].)

Note, however, that nhc98 isn't much maintained anymore either.

Of the actively maintained implementations, jhc, and UHC support only a small part of the FFI (primitive foreign imports), according to their respective home pages, so GHC is basically without competition.

OTHER TIPS

All Haskell implementations support the FFI, as by definition, it isn't a Haskell compiler if it doesn't implement the language specification (which includes the FFI.

This means Hugs, GHC, nhc98 at a minimum.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top