[Haskell-cafe] Proposal: Non-recursive let

Edward Kmett ekmett at gmail.com
Fri Jul 12 04:35:36 CEST 2013


Lens even supplies this as (&)

On Thu, Jul 11, 2013 at 5:18 PM, Andreas Abel <andreas.abel at ifi.lmu.de>wrote:

> I can do this without extra indentation:
>
>   (|>) = flip ($)
>
>   f = 5 |> \ x ->
>       6 |> \ y ->
>       x + y
>
> Non-recursive let is as superfluous as the do-notation.
>
>
> On 11.07.2013 17:40, Carter Schonwald wrote:
>
>> Yup. Nested cases *are* non recursive lets.
>>
>> (Can't believe I forgot about that )
>>
>> On Thursday, July 11, 2013, Edward Kmett wrote:
>>
>>     On Wed, Jul 10, 2013 at 3:47 AM, <oleg at okmij.org <javascript:_e({},
>>
>>     'cvml', 'oleg at okmij.org');>> wrote:
>>
>>
>>         Jon Fairbairn wrote:
>>          > It just changes forgetting to use different variable names
>>         because of
>>          > recursion (which is currently uniform throughout the language)
>> to
>>          > forgetting to use non recursive let instead of let.
>>
>>         Let me bring to the record the message I just wrote on
>> Haskell-cafe
>>         http://www.haskell.org/**pipermail/haskell-cafe/2013-**
>> July/109116.html<http://www.haskell.org/pipermail/haskell-cafe/2013-July/109116.html>
>>
>>         and repeat the example:
>>
>>         In OCaml, I can (and often do) write
>>
>>                  let (x,s) = foo 1 [] in
>>                  let (y,s) = bar x s in
>>                  let (z,s) = baz x y s in ...
>>
>>         In Haskell I'll have to uniquely number the s's:
>>
>>                  let (x,s1)  = foo 1 [] in
>>                  let (y,s2)  = bar x s1 in
>>                  let (z,s3)  = baz x y s2 in ...
>>
>>         and re-number them if I insert a new statement.
>>
>>
>>     blah = case foo 1 [] of
>>        (x, s) -> case bar x s of
>>           (y, s) -> case baz x y s of
>>             (z, s) -> ...
>>
>>     -Edward
>>
>>
>>
>> ______________________________**_________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>>
>>
>
> --
> 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/ <http://www2.tcs.ifi.lmu.de/~abel/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130711/92eac5c3/attachment.htm>


More information about the Haskell-Cafe mailing list