
[I posted this on the Template Haskell list, but nobody seemed interested. Thus, I'm re-posting it here for higher coverage.] Apparently, I can create a function declaration (FunD) with a name 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, "ep" and ":#:", 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 though, that I wouldn't know how to do this easily within the bounds of the TH API. The Name type is common to functions, infix operators, and everything else. That which is valid for one is not necessarily so for the other. Regards, Sean

On 2008 Oct 17, at 7:33, Sean Leather wrote:
Apparently, I can create a function declaration (FunD) with a name containing an invalid sequence of characters. It passes typechecking and compiles. It even shows up in GHCi!
This may be a feature. Consider that internal functions use # as an alphanumeric (via an extension); it can be useful to have names that can't be used in ordinary code. This is an inevitable aspect of being able to program at a level which permits symbol table manipulation. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (2)
-
Brandon S. Allbery KF8NH
-
Sean Leather