Defining custom pragmas in haskell

I'm interested in the opportunity to define my own pragma in the GHC.

I suggest that I should add it to lexer and parser. But what should I write to the parser to tell the GHC how to handle my pragma?

Thanks in advance!

+4
source share
1 answer

You will need to add additional changes to topdeclproduction in Parser.y . No separate lexer modifications are required. Following the examples of the DEPRECATED / WARNING / RULES pragmas, the definitions of which also begin there, you will need to define some additional data types and documents for processing documents in such modules as HsDeclsand RnSource, but if you follow the template of the previous similar work, this should be easy. (I also find that GHC developers are known to be useful on IRC and mailing lists.)

+2
source

Source: https://habr.com/ru/post/1614911/


All Articles