[Haskell-cafe] Non-recursive let [Was: GHC bug? Let with guardsloops]

Andreas Abel andreas.abel at ifi.lmu.de
Thu Jul 11 00:04:10 CEST 2013


On 10.07.13 6:00 PM, Donn Cave wrote:
> quoth Alberto G. Corona,
>
>> Let is "recursive" because, unlike in the case of other
>> languages, variables are not locations for storing values, but the
>> expressions on the right side of the equality themselves. And obviously it
>> is not possible for a variable-expression to be two expressions at the same
>> time. The recursiveness is buildt-in. It comes from its pure nature.

@Alberto: you must have misunderstood my proposal.

> I'm surprised that it would come down to purity.  It looks to me like
> simply a question of scope.  I had to write an example program to see
> what actually happens, because with me it isn't "intuitive" at all that
> the name bound to an expression would be "visible" from within the
> expression itself.  I suppose this is considered by some to be a feature,
> obviously to others it's a bug.

Value-recursion *is* useful in a lazy language, e.g.

   let xs = 0 : xs

builds an infinite (in fact, circular) list of 0s.  But it is not always 
meaningful, e.g.

   let x = x + 1

simply loops.  I would like to be in the position to tell Haskell what I 
mean, whether I want recursion or not.

> I've gone to some trouble to dig up an nhc98 install (but can't seem to
> find one among my computers and GHC 7 won't build the source thanks to
> library re-orgs etc.)  Because, I vaguely recall that nhc98's rules
> were different here?  Anyone in a position to prove me wrong?

I would doubt that nhc98 would interpret  let xs = 0 : xs  differently 
than ghc if it implemented anything close to the Haskell 98 standard. 
But I am not in a position to prove you wrong.

Cheers,
Andreas

-- 
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