[Haskell-cafe] On the purity of Haskell

Gregg Reynolds dev at mobileink.com
Thu Dec 29 18:14:27 CET 2011


On Dec 29, 2011, at 11:01 AM, Iustin Pop wrote:

> On Thu, Dec 29, 2011 at 05:55:24PM +0100, Iustin Pop wrote:
>> On Thu, Dec 29, 2011 at 05:51:57PM +0100, Jerzy Karczmarczuk wrote:
>>> Iustin Pop::
>>>> In practice too:
>>>> 
>>>> bar _ = do
>>>>   s<- readFile "/tmp/x.txt"
>>>>   return (read s)
>>>> 
>>>> Once you're in a monad that has 'state', the return value doesn't
>>>> strictly depend anymore on the function arguments.
>>> Nice example. PLEASE, show us the trace of its execution. Then, the
>>> discussion might be more fruitful
>> 
>> Sorry?
>> 
>> I did the same mistake of misreading the grand-parent's "IO Int" vs.
>> "Int", if that's what you're referring to.
>> 
>> Otherwise, I'm confused as what you mean.
> 
> And to clarify better my original email: yes, (bar x) always gives you
> back the same IO action;

More precisely: the same *type*.

> but the results of said IO action are/can be
> different when executed.
> 

-Gregg



More information about the Haskell-Cafe mailing list