Type of an HsExpr

Ranjit Jhala jhala at cs.ucsd.edu
Mon May 23 17:12:06 CEST 2011

Dear Sven,

> However for the other parameters, I use empty values:
> 3) emptyGlobalRdrEnv
> 4) emptyTypeEnv
> This actually works (at least for the simple cases I have tested).
> But it seems wrong to me to pass two empty environments.
> Can I somehow obtain valid environments?

(disclaimer: I am _very_ new to this!) You may be able to extract 
those fields from the "ModGuts"obtained by compiling the file that 
you are traversing.

> Another question: Why is dsExpr monadic?
> What side effects could there possibly be?

The desugaring process (of which dsExpr is a part) creates a 
bunch of distinct ("fresh") names. To do so it needs to tap 
into the Unique supply (see newUniqueId.) In addition, the 
DsM tracks some environments, source locations (getSrcSpanDs, 
putSrcSpanDs) etc...


More information about the Glasgow-haskell-users mailing list