[Haskell-cafe] Why isn't hsc2hs functionality provided by ghc?

Jeremy Shaw jeremy at n-heptane.com
Thu Jun 6 05:43:35 CEST 2013


While hsc2hs is a popular FFI preprocessor, it is not the only one.
There is also greencard and a few others.

While hsc2hs can usually get the job done -- it's not clear that it is
really the best choice. I think the Haskell FFI got to the point that
it was 'just good enough' and then people lost interest in doing
anything more. Let's face it -- working on the FFI is just not that
exciting :)

So, basically, we are stuck with stuff that is 'good enough' but no so
great that we want to make it official.

We can bind to C fairly easily, but for C++, Python, Ruby, Javascript,
Java, etc, we have never really made much headway.

I think the efforts to make cabal-ghci work nicely could really be the
best solution for now. That is more extensible, and makes it easy to
solve the problem you actually care about (being able to easily
load/compile .hs files) with out giving priority to any particular FFI
system.

- jeremy

On Tue, Jun 4, 2013 at 9:02 PM, silly8888 <silly8888 at gmail.com> wrote:
> I was wondering today, why hasn't hsc2hs been merged with ghc so that
> it would be possible to add a
>
> {-# LANGUAGE ForeignFunctionInterface #-}
>
> at the top of a source file and then load it with ghci or compile it,
> without the intermediate step of calling hsc2hs? This would be exactly
> like the CPP extension. I don't have to call cpp manually. All I have
> to do is to add {-# LANGUAGE CPP #-} and then ghc will take care of
> the rest. This would also mean that there would be no need to have a
> separate file extension. Surely I must not be the first person to have
> that thought, so there must be a good reason why this hasn't happen
> yet, but what is it?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list