Ismael Figueroa Palet | 28 Feb 16:03 2013
Picon

Implementing name-mangling in GHC?

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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane