Exposing newtype coercions to Haskell

Nicolas Frisby nicolas.frisby at gmail.com
Tue Jul 2 19:56:24 CEST 2013

This is an exciting effort! Just a quick reaction to Simon's comments on

On Tue, Jul 2, 2013 at 9:11 AM, Simon Peyton-Jones <simonpj at microsoft.com>wrote:

>  To your questions:
> **
> **·        **To do these kind of things, CoreM will need more reader
> stuff.  In particular:****
> **o   **The global TypeEnv****
> **o   **The GlobalRdrEnv
For my light experimentation, I have recovered these two values from the
ModGuts that all plugins receive. Hopefully someone will shout out if
there's pitfalls to avoid.

  * The mg_rdr_env field is of type GlobalRdrEnv.

  * compiler/main/GHC.hs defines a function compileCore with a local
definition that rebuilds a TypeEnv. I extracted this:

> \guts -> HscTypes.typeEnvFromEntities (CoreSyn.bindersOfBinds (mg_binds
>                                            (mg_tcs guts)
>                                            (mg_fam_insts guts)

and it has worked so far.

HTH and good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130702/59fb697b/attachment.htm>

More information about the Glasgow-haskell-users mailing list