[Haskell-cafe] Store type-class polymorphic values generically

Simon Peyton-Jones simonpj
Fri Oct 4 10:40:41 UTC 2013


| However, I want to write this as a core-to-core
| translation as a ghc-plugin. I want the definition go = putStrLn "Hello
| World!" to be translated to what I wrote above. Core cannot generate new
| names to be exported from a module, so go_ is now gone.

Wait... what do you mean "Core cannot generate new names to be exported".  I think a core-to-core plugin can certainly generate new top-level function definitions.  

Maybe you mean that you want your plugin to transform

	module M( f ) where
	  f = e
into
	module M( f_ ) where
	  f_ = ...f...
   	  f = e

That seems pretty drastic, because now the programmer's API for the module has changed.  Are you sure you don't want to do this

	module M( f ) wehre
	  f_ = e
	  f = ...f_...

by renaming the existing f with some local name.

I don't like all this unsafe hackery!

Simon



More information about the Haskell-Cafe mailing list