[Haskell-cafe] Byte Histogram

Evan Laforge qdunkan at gmail.com
Mon Feb 7 23:31:17 CET 2011


> The distinction between let and letrec predates OCAML.  Scheme does it too.

Haskell's choice of recursive everywhere is nice for the syntax, but
occasionally error prone.  I don't actually use explicit recursion too
often because there are functions for that, but I still occasionally
typo a variable name and make a circular reference, say naming a
function's output the same as one of its inputs.  If they're the same
type then you get that least-friendly of crashes: an error-less hang
with no indications about where it is.  It means you sometimes can't
reuse variable names when it would be better to shadow the old one and
sometimes wind up with tricks like 'x <- return $ f x'.

So there's a case to be made for letrec too.



More information about the Haskell-Cafe mailing list