> So, the name of a type is always at least a full word, as are the names of
> specific functions. But type variables are almost always single
> characters, and distinct from the names of any type. Conventionally, they
> are also usually "a", "b", and "c", although "m" is for monad.
> Conventionally also, generic function arguments are "f" and "g", the
> conventional predicate is "p". Generic arguments are "x" and "y" (or "xs"
> and "ys" if they are lists); arguments with specified types are usually
> the first letter of their type name (e.g., "c" for Char, "i" for an Int;
> "n" and "m" are indices)... that covers most of it, I think.
I've never thought about a difference between i (and j) on the one
hand and n and m on the other, besides I would use i, j more locally,
if there were such a difference. So I might use i<-[1..n], but would
nearly never use n<-[1..i].
If I don't do pattern matching on a list, I sometimes use l.
Otherwise, I use (a:as) as well as (x:xs) for lists.
I'm in trouble when it comes to @-patterns: is xs@(x:_) acceptable?
For non-integral numbers, I often use x, y.
> I think most of the Haskell code I've ever seen that *wasn't* written by
> me follow these conventions pretty closely. But the strange thing is...I
> haven't found a prominent place on, e.g., the Haskell home page where this
> is spelled out. (Please tell me if I'm missing anything obvious.) In a
> way, I guess this is trivial, but I know from hard experience it can often
> take a long time to become completely aware of trivial things.
I've seen the (x:xs) (or whatever letter you want, BTW I'd use (f:fs)
for a list of functions) convention written somewhere. Most of the
rest is what is usually used in mathematics or is done in any computer
language (such as c for Char).
Yes, a list of these things might be helpful.
Christian Sievers