28 Feb 2013 16:03
Implementing name-mangling in GHC?
Ismael Figueroa Palet <ifigueroap <at> gmail.com>
2013-02-28 15:03:33 GMT
2013-02-28 15:03:33 GMT
Hi café,
I'm working on a small project, and I need to rename all ocurrences of a data type in a module.
For instance, if the program is
module Foo where
data Bar
fun :: Bar -> Bar
fun = ...
I'd like that during compilation the module looks as if it was written like:
module Foo where
data _BarXZY
fun :: _BarXZY -> _BarXZY
fun ...
I think the simplest way to do this is using TH to define a special $data splice, which directly mangles the name. But then I'd need another splice every time I want to use the type.
I've read other options like implementing a GHC compiler plugin (http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/compiler-plugins.html)
is it possible to perform the renaming by modifying the ModGuts structure in a compiler pass?
Can you please give more pointers on how to perform this task?
Thanks
--
Ismael
Ismael
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RSS Feed