[Haskell-cafe] Re: Can we come out of a monad?
es at ertes.de
Mon Aug 2 01:09:38 EDT 2010
Ivan Miljenovic <ivan.miljenovic at gmail.com> wrote:
> On 2 August 2010 14:47, Lyndon Maydwell <maydwell at gmail.com> wrote:
> > I thought it was pure as, conceptually, readFile isn't 'run' rather
> > it constructs a pure function that accepts a unique world state as a
> > parameter. This might be totally unrealistic, but this is how I see
> > IO functions remaining pure. Is this a good mental model?
> That is what I believe Ertugrul is aiming at, but I believe that that
> is a "rule-lawyering" interpretation in trying to argue that all of
> Haskell is pure. We could use this same argument to state that _all_
> programming languages are pure, as they too have implict "World" state
> variables that get passed around.
Given the definition of a Haskell function, Haskell is a pure language.
The notion of a function in other languages is not:
The result of this function is an integer. You can't replace the
function call by its result without changing the meaning of the program.
In Haskell, this wouldn't even be a function. It would be a
computation, i.e. simply a value.
nightmare = unsafePerformIO (getWrongWife >>= sex)
More information about the Haskell-Cafe