[Haskell-cafe] let and fixed point operator
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Fri Aug 31 16:16:57 EDT 2007
On Aug 31, 2007, at 16:01 , Sterling Clover wrote:
> In particular for a function -- n, m, etc or x, y, etc? What about
> for f' defined in a let block of f? If I use x y at the top level I
> need to use another set below -- is that where x' y' are more
> appropriate, or x1, y1?
Usual style is x',y'.
For longer names, camelCase is the usual convention but some
libraries which basically import everything from C via the FFI use
C_style_names. Imported constants/macros which are uppercase with _
tend to be mapped to tHIS_KIND_OF_NAME (see for example the Win32
package).
One thing to watch out for is that monads tend to carry their own
metaconventions: a generic monad is "m", a reader monad is "r", a
state monad is "s", functors are "f".
> For tuples I tend to pattern match with (a,b), and for lists I tend
> to use (h:r) for head and rest. Are there
The common convention for lists is e.g. (x:xs) (the latter is "x-es").
> other, more universal standards for these sorts of things? Another
> related question is whether using these short sweet variable names
> makes sense, or whether I should try to use more descriptive ones.
I generally use something short but descriptive when writing
something specific, and single-character generic names when writing
something that's generic and/or polymorphic.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Haskell-Cafe
mailing list