On 20/09/2007, Ryan Ingram <[EMAIL PROTECTED]> wrote:

> I think a more consistent behavior would be to not print the LHS at
> all.  If you wanted to print the result of the computation you could
> just do:
>
>     Prelude> bar 5
>
> or, if you also wanted bound variables afterwards:
>
>     Prelude> (x, Just y) <- bar 5
>     Prelude> (x, Just y)
>
> Perhaps this is my imperative background speaking, but I don't see
> much difference at the GHCi prompt between these two:
>
>     Prelude> let x = 5
>     Prelude> x <- return 5

I agree with this interpretation. If I want to just *do* the action,
I'll type it. If I want to *store* the action then I'll bind it to
something. That's the intuition I have, anyway. And it works for pure
functions:

Prelude> let ns = [1..]
Prelude> [1..]

The difference between those two feels like the difference between:

Prelude> contents <- readFile "massive.txt"
Prelude> readFile "massive.txt"

But as Ryan mentioned, this may just be poor intuition from an overly
imperative mindset...

Cheers,

D.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to