[Haskell-cafe] Implementing name-mangling in GHC?

Ismael Figueroa Palet ifigueroap at gmail.com
Thu Feb 28 16:03:33 CET 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130228/6afaa4c6/attachment.htm>


More information about the Haskell-Cafe mailing list