How to get started with a new backend?

David Terei davidterei at
Mon Jan 28 08:21:06 CET 2013

I believe that some Microsoft Research folks at Cambridge got a fairly
far along implementation of Haskell on Java or .NET many years back
but concluded it wasn't a good fit. My rusty memory of a conversation
with Simon Marlow about this was that all the Java libraries basically
ended up in IO and matching the API and type design up with Haskell
wasn't very nice.

Not sure what the motivation is, but you may want to look at VMKit: It could be a good fit and may be easy to use
through the LLVM backend.

On 27 January 2013 17:15, Jason Dagit <dagitj at> wrote:
> I would like to explore making a backend for .NET. I've done a lot of
> background reading about previous .NET and JVM attempts for Haskell. It
> seems like several folks have made significant progress in the past and,
> with the exception of UHC, I can't find any code around the internet from
> the previous efforts. I realize that in total it's a huge undertaking and
> codegen is only one of several significant hurdles to success.
> I would like to get a very, very, very simple translation working inside
> GHC. If all I can compile and run is fibonacci, then I would be quite happy.
> For my first attempt, proof of concept is sufficient.
> I found a lot of good documentation on the ghc trac for how the compilation
> phases work and what happens in the different parts of the backend. The
> documentation is excellent, especially compared to other compilers I've
> looked at.
> When I started looking at how to write the code, I started to wonder about
> the "least effort" path to getting something (anything?) working. Here are
> some questions:
>   * Haskell.NET seems to be dead. Does anyone know where their code went?
>   * Did lambdavm also disappear? (JVM I know, but close enough to be useful)
>   * Would it make sense to copy&modify the -fvia-C backend to generate C#?
> The trac claims that ghc can compile itself to C so that only standard gnu C
> tools are needed to build an unregistered compiler. Could I use this trick
> to translate programs to C#?
>   * What stage in the pipeline should I translate from? Core? STG? Cmm?
>   * Which directories/source files should I look at to get familiar with the
> code gen? I've heard the LLVM codegen is relatively simple.
>   * Any other advice?
> Thank you in advance!
> Jason
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list