[Template-haskell] Internal type consistency of quoted expressions

Ian Lynagh igloo at earth.li
Mon Jul 31 17:25:54 EDT 2006


Hi Liyang,

On Fri, Jul 28, 2006 at 12:32:00PM +0100, Liyang HU wrote:
> 
> My current want-it-now 'solution' is to comment out the sole
> tcSimplifyBracket invocation in ghc/compiler/typecheck/TcSplice.lhs.
> Clearly this is the wrong approach, seeing as other people would like
> to use this too. (I presume this will do what I want. I'm still
> waiting for stage1 to finish building...)
> 
> I guess a more constructive approach would be to hack in an
> alternative unchecked quotation bracket, [s| ... |] say ('s' stands
> for 'syntax'). If upstream is willing to consider such an extension,
> I'll get started...

I actually proposed something similar way back:
http://www.haskell.org//pipermail/template-haskell/2003-April/000048.html
for specifying rewrite rules which weren't all type correct in
themselves, but the total effect of fully applying them all was type
safe. I didn't push it much as it wasn't that important to me and no-one
else seemed interested (plus it felt a bit hackish).

There's probably a patch in the archive of one of the lists, but it's
probably easier just to recreate it than to track it down and
forward-port it.

> Any alternative suggestions before I do? :-/

Small point, but I'd prefer [| ... |s] as the middle of [| already has a
use.

> [2] I am sane, right? I mean, is there any other reason for the
> internal type-consistency check other than to detect /potential/
> errors /earlier/?

I can't remember OTTOMH when the fixities of infix expressions get
corrected, i.e. I'm not sure if expressions like (x .+. y .+. z) might
get parsed as if the operator bound the wrong way.


Thanks
Ian



More information about the template-haskell mailing list