[Haskell-cafe] Idea: Source maps for GHC's -pgmF

Christopher Done chrisdone at gmail.com
Sat Mar 30 01:11:35 CET 2013


Here's an idea. For the -pgmF flag, because compile errors become
really obscure and line numbers rendered unhelpful, why don't we use
source maps as recently done for JavaScript in the browser?

Info:

https://wiki.mozilla.org/DevTools/Features/SourceMap

https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit

Here is an example I experimented with the Fay (Haskell→JS compiler):

https://dl.dropbox.com/u/62227452/Screenshots/Screenshot%20from%202012-09-26%2000%3A48%3A01.png

This shows the original source code and a backtrace of an exception
thrown in JavaScript.

We can use Mozilla/Google's format:
http://hackage.haskell.org/package/sourcemap Though it's kind of an
obscure format because it's aimed at being small, but if it's already
been done, why not? Otherwise a simple JSON format is probably
sufficient.

It could be used both in GHC's compilation, pattern match exceptions,
and even in debugger stepping, if desired. Provided with, e.g. -pgmFsm
foo.map. This would make things like the XML mode or other syntactical
extensions feel quite natural and not awkward in GHC's error messages.

What say you, -pgmF users and GHC hackers?

Ciao!



More information about the Haskell-Cafe mailing list