[Template-haskell] Release

Manuel M T Chakravarty chak@cse.unsw.edu.au
Wed, 28 May 2003 00:09:36 +1000 (EST)


"Simon Peyton-Jones" <simonpj@microsoft.com> wrote,

> | The Maybe module defines one datatype.  THSyntax defines
> | many.  One problem is that constructors of some of these
> | data types clash.  For examples both Exp and Pat have
> | variables and literals.
> 
> Fair enough.  Let's use 'P' for Pat, and nothing for Exp.  Thus Var and
> VarP or PVar.  I.e. leave Exp, the heaviest hitter of all, unannotated.
> Would that serve?
> 
> Then the only oddities are 'Let' and 'Case' because the lower-case smart
> constructors (only) clash with the Haskell keywords.  Is that a good
> enough reason to add 'E' to every constructor (concrete and smart)?  My
> nose says 'no' but yours may differ.  For these, I think Let/letE and
> Case/caseE are not so bad.  An alternative would be to use Bind and
> Switch instead.

`Bind'/`bind' has the same number of characters as
`LetE'/`letE' and `Switch'/`switch' has even one more
character than `CaseE'/`caseE'.

I still think the number one priority is to have no
exceptions in the naming scheme.  If you want to go for one
letter suffixes, that's perfectly fine with me.  If you
absolutely don't want to spent the extra letter on the
constructors of Exp, so be it.  However, I am pretty sure,
plenty of people will write `LetE' in their programs
(because it is the name consistent with the rest of module),
only to get a compiler error, look at the interface of
THSyntax, go back into their editor, and remove the `E'.
Then, they will wonder why all constructors have a one
letter suffix, only Exp doesn't.

Sorry for being stubborn on this, but I just don't see the
advantage of saving one character if that risks that people
have to refer to the documentation more often (or at least
get a compiler error before they remember again that they
are dealing with an exception).

Manuel