But an (IO Char) is a value.  You can do all the things with it that
you can do with values, e.g., pass it as an argument, stick it in a
list, etc.  It is a special kind of value, since if it ever "gets in
contact with" the top level it will be executed.
But the fact that IO types also behave as values makes Haskell a very
powerful imperative language.

On Mon, Feb 9, 2009 at 11:14 AM, Tony Morris <tmor...@tmorris.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> You're right - my statement is inaccurate.
>
> Implementation details aside, I am referring specifically to the
> statement "getChar ... has the type signature of a value". It clearly
> does not.
>
> Lennart Augustsson wrote:
>> Not it doesn't.  getChar has the type signature IO Char. The IO
>> type is abstract.  GHC happens to implement it by a state monad.
>> But in, e.g., hbc it is implemented in a totally different way,
>> more like a continuation monad.
>>
>> Peeking inside an implementation of IO can be illuminating, but one
>> must remember that IO is abstract.
>>
>> -- Lennart
>>
>> On Mon, Feb 9, 2009 at 10:26 AM, Tony Morris <tmor...@tmorris.net>
>> wrote: Gregg Reynolds wrote:
>>>>> The point being that the metalanguage commonly used to
>>>>> describe IO in Haskell contains a logical contradiction.  A
>>>>> thing cannot be both a value and a function, but e,g, getChar
>>>>> behaves like a function and has the type signature of a
>>>>> value.
>> getChar has the signature RealWorld -> (RealWorld, Char)
>>
>>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>
> - --
> Tony Morris
> http://tmorris.net/
>
> S, K and I ought to be enough for anybody.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkmQAfkACgkQmnpgrYe6r61tmQCcCx42Cz1iunkD7JGubla/z2Pg
> uhAAoLk5rkjeHnrfc936IhYoBQYO/+0r
> =6xWk
> -----END PGP SIGNATURE-----
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to