[Haskell-cafe] A beginners question

Steve Lihn stevelihn at gmail.com
Sat Feb 23 11:36:15 EST 2008


>
> fmap (^4) [1,2,3] >>= \i -> shows i " "
>
> gives
>
> "1 16 81 "
>
You are in the list comprehension in a monadic expression. shows is
called three times (i is int).

> then why does
>
> let i = fmap (^4) [1,2,3] in shows i " "
>
> give
>
> "[1,16,81] "
>

"shows" is called once (i is a list).


More information about the Haskell-Cafe mailing list