[Haskell-cafe] Experimental compilation of Haskell to Erlang

Neil Mitchell ndmitchell at gmail.com
Mon May 19 14:52:08 EDT 2008


>> Some time ago I became interested in compilation of Haskell programs
>> (via Yhc Core) to Erlang to be able to run Haskell code in Erlang
>> environment.
> Two (somewhat tangental) thoughts come to mind.
> 1. Should it not, in theory at least, be *relatively* easy to target Haskell
> at anything that has a graph reduction machine? (You target Erlang, somebody
> else has targetted JavaScript, I myself attempted to target Java...)

It's a fair bit of engineering work, there are some design decisions
to be made - such as how to interface with the host language (if at
all). Theoretically its not that hard to come up with something, but
it is a fair amount of effort.

> 2. How come all these projects use Yhc? According to the wiki, Yhc doesn't
> even _work_ yet. What gives?

These projects use Yhc.Core - a Core language to which Haskell can be
translated. At the moment, Yhc is the only compiler that can generate
Yhc.Core, but Yhc.Core is a complete abstraction layer. There is
currently work going on to translate GHC.Core to Yhc.Core, which would
mean that you can then translate any GHC program (including
rank-2-implicit-polymorphic-linear-super-ADTs etc.) to Yhc.Core, and
then on to Erlang. The actual translation is trivial, but getting
GHC.Core out of GHC for all the base libraries is hard.

The reason I use Yhc.Core is because its a nice standalone library,
with useful tools and functionality, which is highly stable. There is
no library which is comparable.



More information about the Haskell-Cafe mailing list