[Template-haskell] Using a Typ as a Type

Simon Peyton-Jones simonpj@microsoft.com
Wed, 3 Sep 2003 14:19:23 +0100


| > TH doesn't support type splices today; that's one of the things I'm
| > actively working on.  But I'm not sure if this is what you meant.
|=20
| It is but it is very important that:
|=20
| 1) We can do dictionary lookups using the spliced type.
|=20
|=20
| 2) The lookup happen at compile time so that it can affects the
|    code being generated.
|=20
| 3) Instances declared in the code being compiled (like the DIS
|    instances above) can be found by this mechanism.  That is,
|    I'm not interested in finding any DIS instances that might have
|    been present in the source code for ghc.

Type splices will behave exactly like expression splices today.=20

I'm not sure whether that fulfils your 1-3 reqts.  Perhaps the thing to
do is to give a simple but concrete example of what you'd like to do.  I
couldn't understand the example you gave last time, as I mentioned.   Do
you think it still says what you mean?  Could you give a line by line
explanation of what you think should take place?

Remember, the execution of TH program can be described by ordinary
rewriting rules (replace the LHS of a function by the RHS of the
function, suitably instantiated), augmented with the one extra rule
	$[| e |]  =3D  e

(Unless you use explicit do-notation.)

Simon