Sean Leather | 14 Oct 16:54 2008

Creating a invalid declaration in TH

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.

template-haskell mailing list
template-haskell <at>