Naming and coding style (was: [Haskell-cafe] First time haskell - parse error!)

Daniel Fischer daniel.is.fischer at web.de
Wed Mar 10 08:45:41 EST 2010


Am Mittwoch 10 März 2010 13:03:59 schrieb Ketil Malde:
> never introduce names if it increases the
> size of your program.  (Corrolary: don't name things that aren't
> referred to at least twice)

Objection!

If the final result of your function is a combination of a handful or two 
of long (and convoluted (expressions with ++ lots of) parentheses (as well 
(as operators and) other stuff), please, please, pretty please with sugar 
and cream, give names to the parts to expose the overall structure of the 
result.

Well, IMO, parts and intermediate results needn't even be so extreme to 
deserve a local name. Just stop and think for a moment before introducing a 
local name, "Does that help or hinder readability?". If you aren't sure, 
probably either is okay.



More information about the Haskell-Cafe mailing list