
I'm working my way through Real World haskell, and so far have found
the experience quite pleasant (though the harder exercises seem to
require things net yet covered).
Among the comments in the IO chapter was a discussion of whether or
not some monad was or was not a function, which got me thinking.
Values in haskell aren't evaluated until they're needed. They're
implemented as thunks, meaning they're roughly zeroadic functions that
will return the value when called.
The syntax of the language seems to make treating values as zeroadic
functions that return the value in question a reasonable
interpretation as a degenerate case:
(+) accepts two arguments and returns their sum.
(+ 5) accepts one argument and returns that plus 5.
(3 + 5) accepts zero arguments and returns 8.
or (more pedantically):
(+) accepts one argument and returns a function that accepts one
argument and returns a zeroadic function that returns the
value of the sum of the two arguments.
(+ 5) accepts one argument and returns a zeroadic function that ...
(3 + 5) a zeroadic function that returns 8
So the question is - is there any advantage or harm in this way of
looking at values?
Thanks,

Hi,
I'm going thru RWH [Real World Haskell] too...
I'm finding it to be an excellent way to learn Haskell. I prefer it to the
Computer Scientist geared books that I'm also reading...
I also found "Learn You a Haskell for Great Good!" to be very worthwhile -
I've ordered a copy of it and it should be availble at the end of April, see
link:
http://book.realworldhaskell.org/read/code-case-study-parsing-a-binary-data-...
I found a link for RWH too - it is:
http://fldit-www.cs.uni-dortmund.de/~peter/RealWorldHaskell.pdf
BTW: I'm also an independent software consultant -- been doing it for 30+
years...
As for your question, I'm not, as yet, prepared to answer it...but it seems
to me that 'Sections' and 'Currying' are very important in the study of
Haskell...but I'm still in 'newbie' status...
I tried to install TK on my Windows Vista PC but was unable to do so...I
will try it again, using RWH - if you're heading there too, please let me
know - perhaps we can work this together...
I also took a look at Category Theory books but so far I'm stumped with it -
it's starting to make a bit of sense but I don't know if I'll be able to
link it to Haskell...
Good luck to both of us...
Pat
----- Original Message -----
From: "Mike Meyer"
I'm working my way through Real World haskell, and so far have found the experience quite pleasant (though the harder exercises seem to require things net yet covered).
Among the comments in the IO chapter was a discussion of whether or not some monad was or was not a function, which got me thinking.
Values in haskell aren't evaluated until they're needed. They're implemented as thunks, meaning they're roughly zeroadic functions that will return the value when called.
The syntax of the language seems to make treating values as zeroadic functions that return the value in question a reasonable interpretation as a degenerate case:
(+) accepts two arguments and returns their sum. (+ 5) accepts one argument and returns that plus 5. (3 + 5) accepts zero arguments and returns 8.
or (more pedantically):
(+) accepts one argument and returns a function that accepts one argument and returns a zeroadic function that returns the value of the sum of the two arguments. (+ 5) accepts one argument and returns a zeroadic function that ... (3 + 5) a zeroadic function that returns 8
So the question is - is there any advantage or harm in this way of looking at values?
Thanks,
http://www.mired.org/consulting.html Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Good afternoon, I'm just about finished researching Monads - wow! I'm still trying to figure out Category Theory. I would like to explore LINQ. Can anyone give me a book reference or tutorial reference? for it? In addition, should it be studied with F# or with C#? Good day

On Mon, Mar 28, 2011 at 4:08 PM, Patrick Lynch
Good afternoon,
I'm just about finished researching Monads - wow! I'm still trying to figure out Category Theory.
I would like to explore LINQ. Can anyone give me a book reference or tutorial reference? for it? In addition, should it be studied with F# or with C#?
I don't know about a book, but 101 LINQ Samples has proven useful to me on more than one occasion. As far as F# vs. C#, I would strongly recommend trying it with C#. LINQ is much better integrated into C#. My sense of the LINQ support in F# is that it's more of a proof-of-concept. Surprisingly, LINQ also seems to be much more cumbersome in F#, which is counter to my intuition.
Good day
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Oops. Accidentally dropped the link to 101 LINQ Samples:
http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx
On Mon, Mar 28, 2011 at 9:59 PM, Daniel Pratt
On Mon, Mar 28, 2011 at 4:08 PM, Patrick Lynch
wrote: Good afternoon,
I'm just about finished researching Monads - wow! I'm still trying to figure out Category Theory.
I would like to explore LINQ. Can anyone give me a book reference or tutorial reference? for it? In addition, should it be studied with F# or with C#?
I don't know about a book, but 101 LINQ Samples has proven useful to me on more than one occasion.
As far as F# vs. C#, I would strongly recommend trying it with C#. LINQ is much better integrated into C#. My sense of the LINQ support in F# is that it's more of a proof-of-concept. Surprisingly, LINQ also seems to be much more cumbersome in F#, which is counter to my intuition.
Good day
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Good afternoon Daniel,
Thanks for the link to LINQ -- and for the advice - I'll try it with C# and
not F#...
I'll let you know how I make out...
As for Category Theory, you might try Eugina Cheng's link:
http://www.scss.tcd.ie/Edsko.de.Vries/ct/catsters/linear.php
I'm starting to understand it just a bit...she has a series of short video
lectures that each last less than 10 minutes...be prepared to be
overwhelmed...
Thanks again,
Pat
----- Original Message -----
From: "Daniel Pratt"
Oops. Accidentally dropped the link to 101 LINQ Samples:
http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx
On Mon, Mar 28, 2011 at 9:59 PM, Daniel Pratt
wrote: On Mon, Mar 28, 2011 at 4:08 PM, Patrick Lynch
wrote: Good afternoon,
I'm just about finished researching Monads - wow! I'm still trying to figure out Category Theory.
I would like to explore LINQ. Can anyone give me a book reference or tutorial reference? for it? In addition, should it be studied with F# or with C#?
I don't know about a book, but 101 LINQ Samples has proven useful to me on more than one occasion.
As far as F# vs. C#, I would strongly recommend trying it with C#. LINQ is much better integrated into C#. My sense of the LINQ support in F# is that it's more of a proof-of-concept. Surprisingly, LINQ also seems to be much more cumbersome in F#, which is counter to my intuition.
Good day
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On 23 March 2011 20:17, Mike Meyer
(+) accepts one argument and returns a function that accepts one argument and returns a zeroadic function that returns the value of the sum of the two arguments. (+ 5) accepts one argument and returns a zeroadic function that ... (3 + 5) a zeroadic function that returns 8
So the question is - is there any advantage or harm in this way of looking at values?
Be careful, wise voices appear to conclude it is harmful: http://conal.net/blog/posts/everything-is-a-function-in-haskell/

On Wed, 23 Mar 2011 22:52:12 +0000
Stephen Tetley
On 23 March 2011 20:17, Mike Meyer
wrote: So the question is - is there any advantage or harm in this way of looking at values? [as nullary functions] Be careful, wise voices appear to conclude it is harmful: http://conal.net/blog/posts/everything-is-a-function-in-haskell/
True, they do appear to have concluded that this is harmful. But this
article is more about how people get to that harmful conclusion than
about what's harmful about it. While that answers my question, I'd be
interested in seeing more about why it's harmful.
thanks,

On Wed, Mar 23, 2011 at 04:17:57PM -0400, Mike Meyer wrote:
I'm working my way through Real World haskell, and so far have found the experience quite pleasant (though the harder exercises seem to require things net yet covered).
Among the comments in the IO chapter was a discussion of whether or not some monad was or was not a function, which got me thinking.
Values in haskell aren't evaluated until they're needed. They're implemented as thunks, meaning they're roughly zeroadic functions that will return the value when called.
The syntax of the language seems to make treating values as zeroadic functions that return the value in question a reasonable interpretation as a degenerate case:
(+) accepts two arguments and returns their sum. (+ 5) accepts one argument and returns that plus 5. (3 + 5) accepts zero arguments and returns 8.
It makes sense as a degenerate case if you look at things this way...
or (more pedantically):
(+) accepts one argument and returns a function that accepts one argument and returns a zeroadic function that returns the value of the sum of the two arguments. (+ 5) accepts one argument and returns a zeroadic function that ... (3 + 5) a zeroadic function that returns 8
... but as you note, really all functions take *one* argument, so now calling values "zero-argument" functions seems less like a degenerate case and more just like a weird special case.
So the question is - is there any advantage or harm in this way of looking at values?
However, I don't think it's really all that harmful, and may even give you some good intuition for laziness. In a strict language, if you want a lazy value of type T you can replace it by a function () -> T -- which is sort of like a "zero-adic" function since it does take an argument, but that argument contains no information. -Brent

Mike Meyer
So the question is - is there any advantage or harm in this way of looking at values?
One harm is that you are mixing two concepts, which Haskell specifically tries to keep separate: functions and procedures. A function maps a value to another value. A "zeroadic function" hence is not a function. It is indeed a value and the thunk concept is just a technical detail, about which you shouldn't bother. You can write proper Haskell programs without ever knowing, what a thunk is or how lazy evaluation is /implemented/. Now in most strict languages there are no real functions, and procedures are just named "functions" for some reason. In my opinion the "zeroadic function" view is going to hurt you much more than it is going to help you. Brent makes a good point that it may help you, when coming from a strict language, but on the other hand understanding lazy evaluation, non-strictness and forcing will make Haskell much more natural to you. With zeroadic "functions" you may end up not writing natural Haskell programs, but just trying to fit your strict view into the non-strict, lazily evaluated world. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/

2011/3/27 Ertugrul Soeylemez
You can write proper Haskell programs without ever knowing, what a thunk is or how lazy evaluation is /implemented/.
While this is probably true, in my case learning about thunks was a major step in understanding haskell. Coming from an imperative perspective, I always had the habit of matching langage constructs with how that would be done in assembly. It felt like I would never be able to move forward with understanding haskell as long as I didn't understand (at least in a fuzzy way) how it works at the lower levels. Also knowing about thunks probably help understand strictness, space leaks issues and so on, which tend to be necessary to write proper Haskell programs. David.
participants (7)
-
Brent Yorgey
-
Daniel Pratt
-
David Virebayre
-
Ertugrul Soeylemez
-
Mike Meyer
-
Patrick Lynch
-
Stephen Tetley