Compiler-explorer: GHC Backend for Haskell

Created on 2 Jun 2017  路  4Comments  路  Source: compiler-explorer/compiler-explorer

Hey @mattgodbolt - I'm having a blast with your compiler explorer winning arguments on the internet about generated C++ code ;) It looks like by now you also provide backends for D, Rust and Go.

I asked around in the Haskell community and nothing like your compiler explorer is available for the several intermediate representations GHC compiles Haskell code down to.

What's your take on having a GHC backend for compiling Haskell code down to Core and maybe all the way down to assembly? Here's a high-level GHC overview:

https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GeneratedCode

What's your take on this? What needs to be done to make this happen?

The Haskell community badly needs a tool like your compiler explorer for situations where Haskell's high level abstractions need to be opened up to have a look what's actually going on.

new-compilers question

Most helpful comment

I've got a prototype of this working, will clean it up a bit and make a pull request sometime this week.

image

All 4 comments

Would love to include haskell support. To do so:

  • "parser" for generated code needs to work. If there's something like -S for GCC/clang then we're there. Anything else needs a bit of work in the compiler driver (see lib/compilers/*.js)
  • Syntax highlighter for haskell code (see static/asm-mode.js for example; should be straightforward.
  • Installation of GHC compilers. Has to be able to be installed in /opt/compiler-explorer/ and run simply without any funny environment variables or setups. Check the sister project compiler-explorer-image to see how they're installed on the CE site: https://github.com/mattgodbolt/compiler-explorer-image/blob/master/update_compilers/install_compilers.sh

I don't have much spare time, nor any haskell experiece, but can certainly help if you don't mind taking a look!

I've got a prototype of this working, will clean it up a bit and make a pull request sometime this week.

image

Wow! That's amazing @TartanLlama !

Looking to release this to the wild tomorrow sometime.

Was this page helpful?
0 / 5 - 0 ratings