ghc feature request: core notes

Hal Daume III hdaume@ISI.EDU
Mon, 3 Feb 2003 15:23:41 -0800 (PST)


I'm not sure how "generally useful" this would be, but I would find it
useful to be able to attach notes to core expressions from the Haskell
code.  The idea being something along the lines of a code annotation like
a pragma.  For instance, in my Haskell program I would have something
like:

  f x y = 
    case {-# CORE "my first note" #-} g x of
      ...

then, the core would come out with, instead of:

  case g x of ...

we would have

  case {note "my first note"} g x of ...

The reason I would find this useful is somewhat obscure, but the basic
idea is that I need to be able to both preprocess code and then change
core based on how it was preprocessed.  I'd like to send annotations like
these out of the preprocessor so they can then be picked up later by my
core transformer.

If this sounds like a good enough idea to go in, but no one has time to
implement it, I could do it myself (probably), but I thought I'd ask the
experts first (or if there's anything like this in there currently)...

 - Hal  

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume