[ghc-steering-committee] A plea for ForeignFunctionInterface

Eric Seidel eric at seidel.io
Thu Dec 31 15:20:30 UTC 2020


On Thu, Dec 31, 2020, at 06:01, Simon Marlow wrote:
> Hi Eric - thanks for the clarification. I'm not against category (2) in 
> general, in fact I think having a LowLevelHaskell category that enables 
> all the unboxed/unlifted-types-related extensions would be a good idea. 
> However, I don't think such a category should include the FFI, because 
> the FFI was designed to be cross-platform, implementation-independent, 
> and to coexist smoothly with the rest of Haskell. I can't see any 
> compelling reason to make it an optional extension.

> I'm also not a fan of endorsing the idea of multiple languages. In my 
> view we should be converging on a single language - every extension is 
> destined to either be in a future GHC20xx or to be deprecated.

I don't think category (2) extensions are necessarily incompatible with
converging on a single language. We could instead aim for a future where
all extensions form a coherent set that *could* be enabled together, and
GHC20xx selects a subset that aims to cover 90% of use-cases. Then
the expectation might be that modules choose a GHC20xx baseline
with zero or more category (2) extensions that enable more advanced
features, specifically those that require a change of mindset. For example,

- the unboxed type extensions imply that we should be thinking carefully
   about performance and allocations

- TemplateHaskell implies (unfortunately) that the order of declarations
   is relevant

Does FFI imply such a change of mindset? I think that's harder to argue,
but something still just feels right about using it as a marker to identify
modules that deal with the FFI.

I think it's also possible that category (2) extensions are not necessary,
but that we've been conditioned to think in terms of using extensions to
silo off advanced functionality because we've had to selectively enable
them for so long.

Joachim, can you change my vote for FFI to "yes"? I think it's already in,
but that should make it safely in.

Eric


More information about the ghc-steering-committee mailing list