[Haskell-cafe] Monad explanation

Tony Morris tmorris at tmorris.net
Mon Feb 9 05:38:13 EST 2009

Hash: SHA1

I also agree it is a value.
The original post was attempting to make a distinction that does not
exist. I deliberately avoided that topic.

"A thing cannot be both a value and a function, but e,g, getChar"

My original intent was to hope the poster reconsidered the whole post.
You've blown my cover :)

Lennart Augustsson wrote:
> 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 <tmorris at tmorris.net>
> wrote: 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
>>>> <tmorris at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

- --
Tony Morris

S, K and I ought to be enough for anybody.

Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Haskell-Cafe mailing list