[Haskell-cafe] On the purity of Haskell
Artyom Kazak
artyom.kazak at gmail.com
Fri Dec 30 22:16:28 CET 2011
Chris Smith <cdsmith at gmail.com> писал(а) в своём письме Fri, 30 Dec 2011
22:04:21 +0200:
> Computability is just a distraction here. The problem isn't whether
> "getAnIntFromUser" is computable... it is whether it's a function at
> all! Even uncomputable functions are first and foremost functions, and
> not being computable is just a property that they have. Clearly this is
> not a function at all. It doesn't even have the general form of a
> function: it has no input, so clearly it can't map each input value to a
> specific output value. Now, since it's not a function, it makes little
> sense to even try to talk about whether it is computable or not (unless
> you first define a notion of computability for something other than
> functions).
Of course getAnIntFromUser is not a function. It is an instruction to
computer.
Think of IO as a form of writing instructions to some worker (essentially,
the kernel, which in its turn uses processor's io ports). You are asking
this “worker” to change some global state.
Thus, your function “f” is a function indeed, which generates a list of
instructions to kernel, according to given number.
More information about the Haskell-Cafe
mailing list