On 2011-12-29 19:44, Steve Horne wrote:
> [Interaction with its environment] is as much an aspect of what
> Haskell defines as the functional core.
> 
> Switching mental models doesn't change the logic
But it does. Other languages do not support the distinction between pure
functions and I/O effects. In those languages a function call is what
triggers I/O.

Haskell uses a different set of types for I/O. It does not use functions
for this. The distinction between pure functions and impure code,
supported by the language, is a valuable logical tool.

You refer to the fact that as part of executing the Haskell program, it
is translated into an AST that does not make that distinction. The
effect getAnIntFromTheUser is translated into a function. The type of
the function says nothing about whether the function has an effect. In
that sense Haskell is impure, but so what? That doesn't take away the
power of Haskell's distinction between pure functions and impure types,
for reasoning about Haskell code.

> Either way, at run-time, Haskell is impure.
No big deal. Who would want to use a language that you would call
"pure"? Haskell has referential transparency. In Haskell, you have
assurance that any function without IO in its type is as pure as the
lambda calculus.

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

Reply via email to