Re: patch applied (ghc): Adding a GENERATED pragma

Duncan Coutts <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.all
Message-ID <1167433231.27410.195.camel__449.895548126911$1167433287$gmane$org@localhost>
On Fri, 2006-12-29 at 09:53 -0800, Andy Gill wrote:
> That is sort of correct, it is more fine grain than line, but also  
> refers to an external file/name.
> 
> #LINE ==> where you are in your *haskell* source file (because  
> perhaps you moved line because of #includes, etc).
> 
> #GENERATED ==> This is part of your Haskell program, but this source  
> was derived (generated or quoted) from
> *another source file*.
> #GENERATED does not alter the internal SrcSpan's for this module in  
> anyway, much like {-# SCC ... and other pragmas.
> 
> A good example is happy. The actions are actually GENERATED from the  
> *.y file. The idea is that you can use Hpc to get
> coverage of a *grammar*, checking that you have actually tested your  
> complete parser. Reading the machine generated
> Haskell is painful :-)
> 
> I'm open to other named than GENERATED. The file aspect is just a  
> name, it could be a component name, the
> usage is domain specific. We could also generalize, and have lines  
> ranges, as well an spans.
> 
> Does this help? What do you think?

LINE can already refer to an external non-.hs file. This is exactly how
things works now with all manner of pre-processors, alex, happy, cpphs,
c2hs, hsc2hs, etc.

I don't quite have an intuition for this yet, can you give an example of
how this more fine grained pragma works and some use-case not currently
covered by LINE?

Duncan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.