[Haskell-cafe] Best way to build a GHC backend?

Niklas Larsson metaniklas at gmail.com
Sun Jul 8 08:54:00 CEST 2012


2012/7/8 Jonathan Geddes <geddes.jonathan at gmail.com>:
> Venerable Haskell Hackers,
>
> I love Haskell and think it should run everywhere. Now supposing I would
> like to build another backend for GHC, perhaps for Java Bytecode, .Net CIL,
> or JavaScript, What would be the best way to approach that? I can think of a
> few options:
>
> 1. Produce External Core with -fext-core and compile that with a completely
> separate compiler
> 2. Use the GHC apis to build a compiler that reuses a load of GHC's code,
> but has it's own backend
> 3. Add a new backend directly into GHC
>
> Any other options?

You can target LLVM bitcode and transform that. And there probably is
an LLVM backend for your favourite target already.

> While I'm on the subject, why has Haskell not been ported to the likes of
> the JVM, .NET CLR, or JavaScript? Are Haskell's non-strict semantics just
> too different from the semantics of these other platforms?
>

http://www.haskell.org/haskellwiki/GHC/FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F
"It would make a lot of sense to give GHC a .NET or JVM back end, and
it's a question that comes up regularly. The reason that we haven't
done it here, at GHC HQ, is because it's a more substantial
undertaking than might at first appear (see below). Furthermore, it'd
permanently add a complete new back-end platform for us to maintain.
Given our rather limited development effort, we have so far not bitten
the bullet, and we have no immediate plans to do so."

The big problem seems to be to create a sensible interop to an
object-orientated framework.

> SPJ is known for saying that Haskell's plan for world domination is support
> for many parallelism/concurrency idioms. I believe running on many platforms
> is just as important. From my point of view, languages that cannot run on
> one of the 3 aforementioned platforms will become irrelevant. (with the
> exception of C, of course).
>
> Thoughts?
>

Javascript (or a possiible common browser VM) seems essential.

Server-side nobody knows or cares what you run on. It would be nice to
be able to interop with Java or dotnet though.

> --J Arthur
>
> _______________________________________________
> 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