Christopher Done | 30 Mar 01:11 2013

Idea: Source maps for GHC's -pgmF

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?


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

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

We can use Mozilla/Google's format: 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

It could be used both in GHC's compilation, pattern match exceptions,
and even in debugger stepping, if desired. Provided with, e.g. -pgmFsm 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?

(Continue reading)