[Template-haskell] Reification

Ian Lynagh igloo at earth.li
Thu Nov 6 04:25:21 EST 2003


On Wed, Nov 05, 2003 at 05:16:41PM -0000, Simon Peyton-Jones wrote:
> Folks
> 
> I'm on the TH warpath, and I'm working on reification.  The idea is that
> 'reify' is not a language construct any more: it's just an ordinary
> function
> 
> 	reify :: Var -> Q Dec

I still prefer "Name" to "Var" (assuming I'm not confused and you can
give it the name of a class, type or whatever).

> Question 1
> ~~~~~~~
> 	reify :: Var -> Q Info

I prefer getting an Info to a Dec, yes.

> Question 2
> ~~~~~~~
> The type checker may not know the full type of the thing.  For example:
> 
> 	f x = $( do { i <- reify 'x; ... } )  .....
> 
> The type of 'x' isn't known yet.  It may get refined by the other "..."
> parts of f's body, or by f's use.  
> 
> So should we give up and refuse to give you f's type?  Or what?

I think it would be best to give what info is available. I think types
that are definitely determined should be distinguishable from those that
aren't (e.g. "we know this is type Num a => a" compared to "this is at
most Num a => a, but it might turn out to be Int"), but highlighting
which component bits are definitely known probably isn't worth the
complexity.


Thanks
Ian



More information about the template-haskell mailing list