[Template-haskell] Creating a invalid declaration in TH

Sean Leather leather at cs.uu.nl
Tue Oct 14 10:54:50 EDT 2008


Apparently, I can create a function declaration (FunD) with a string
containing an invalid sequence of characters. It passes typechecking and
compiles. It even shows up in GHCi!

The function name is "ep:#:", and the :#: is derived from an infix type
constructor. In GHCi (6.8.3), I type "ep", hit <Tab> to get the list of
completions, and, sure enough, there it is! When I try to use it, GHCi
interprets it as two distinct symbols as it should.

Template Haskell's claim to fame is that it allows you to do "type-safe
compile-time meta-programming," and while this issue is perhaps considered
lexical rather than type-level, I'm wondering if there should be some
additional error checking (somewhere) to account for this. I admit, I
wouldn't know how to do this given the TH API, since Name is used for
functions, infix operators, and everything else.

Regards,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/template-haskell/attachments/20081014/f05ec1d5/attachment.htm


More information about the template-haskell mailing list