[Haskell-cafe] Proposal: Non-recursive let
Andreas Abel
andreas.abel at ifi.lmu.de
Mon Jul 22 10:27:38 CEST 2013
On 20.07.13 9:36 PM, Evan Laforge wrote:
> However, I'm also not agitating for a non-recursive let, I think that
> ship has sailed. Besides, if it were added people would start
> wondering about non-recursive where, and it would introduce an
> exception to haskell's pretty consistently order-independent
> declaration style.
For functions, recursive-by-default let makes sense. But for *values*,
intended recursion is rather the exception. It is useful for infinite
lists and the like. For values of atomic type like Int or Bool,
recursive let is a bug.
Of course, if you want to do scope-checking before type-checking, which
also makes sense, you cannot make recursiveness type-dependent.
Distinguishing 'let' into 'fun', 'val' and 'val rec' could help here:
Non-recursive:
val x = e
in e'
Recursive:
fun f x = e
in e'
val rec x = e(x)
in e'
--
Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY
andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/
More information about the Haskell-Cafe
mailing list