[Haskell-beginners] Combining IO and Either function to "EitherT e IO a"

Brent Yorgey byorgey at seas.upenn.edu
Wed Mar 5 23:35:54 UTC 2014


On Wed, Mar 05, 2014 at 03:22:39PM -0800, David Thomas wrote:
> It's a function of zero arguments.

This is really stretching the meaning of the word "function" beyond
any reasonable, useful definition, in my opinion.  See the discussion
here:

  http://conal.net/blog/posts/everything-is-a-function-in-haskell

A much more useful (and precise) point of view is that in Haskell, all
functions take exactly one argument.  Under that view, of course,
there is no such thing as a function of zero arguments.

> It's also sort of, kind of a function
> from RealWorld to (String, RealWorld) if you squint.

I'm don't think this is a very helpful way to understand IO, though it
is probably closer to the sense in which the OP understood IO String
to be a function.

My guess is that what is really going on here is a confusion of
terminology from imperative languages, some of which use the word
"function" for everything, whether they take any arguments or not,
return any values or not, have any side effects or not, etc.

-Brent

> On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:
> 
> >
> > On Thu, Mar 6, 2014 at 12:49 AM, Nathan Hüsken <nathan.huesken at posteo.de>wrote:
> >
> >> Mmh, I might not have used haskell terminology correctly. Its a function,
> >> in the sense of a function of an imperative language ...
> >
> >
> > Yes, you could model IO String in C as a function taking void and
> > returning a pointer to char.
> >
> > Calling an IO String a Haskell function would confuse a lot of people.
> >
> > -- Kim-Ee
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
> >
> >

> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners



More information about the Beginners mailing list