[Haskell-cafe] Haskel let

David Thomas davidleothomas at gmail.com
Mon Apr 1 18:49:18 CEST 2013


On Mon, Apr 1, 2013 at 9:32 AM, Richard Eisenberg <eir at cis.upenn.edu> wrote:

>
> Normal "let":
> In a function (which does not use "do"), you can use "let" to make local
> variables. The word "in" separates the local variable declaration from the
> part of your function where you want to use that variable. Loosely
> translating from Haskell to C++:
>
> Haskell:
> > let foo = bar in baz
>
> C++:
> > /* insert correct type here */ foo = bar;
> > baz
>
>

For the C++, I'd say

> {
>   /* insert correct type here */ foo = bar;
>   baz
> }

for let ... in, whereas let without in (only permitted in do notation)
discards those braces.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130401/7daa89ea/attachment.htm>


More information about the Haskell-Cafe mailing list