Re: [Haskell-beginners] Functional programming principles at higher levels?

On 09/24/2011 09:12 PM, Mike Meyer wrote:
Actually, functional programming and the higher math are separate things. Haskell (and I expect the similar languages) have a lot of math in their documentation. But that's not true for other functional languages, like Clojure or Scheme. With a background in those languages, I didn't have much trouble with the functional nature of haskell. But I'm still trying to recall the graduate math courses I took long time ago in a state far, far different from today.
Really? I'll confess I'm a bit surprised to hear that perspective. I don't know anything about Clojure or Scheme. But I found in trying to understand Haskell that it really is all about higher math. Once I finally gave up on "learnyouahaskell" and other ridiculous tutorials, I found the real functional programming textbooks, and discovered that it all starts with lambda calculus; all the explanations are given in set theory notation, with occasionally comparisons to integral and differential calculus for illustration, with very specific rules regarding substitution and reduction and normal forms. I'm still trying to figure out what all those combinators are about! And it is all rested on mathematical proofs, usually inductive. And that is just the lambda calculus aspect. Then we move on to type theory (!!!) plus the various types of polymorphism, and then on to a number of other topics that I don't know enough about to even mention intelligibly. -- frigidcode.com theologia.indicium.us

I'm curious as to what it is about learnyouahaskell and other similar tutorials that makes them "ridiculous". I found LYAH very helpful when I wanted to actually learn how to get useful things done in Haskell without taking a year off to read about theory. If that approach is ridiculous then I think our definitions of that word differ. On Sat, Sep 24, 2011 at 10:45 PM, Christopher Howard < christopher.howard@frigidcode.com> wrote:
On 09/24/2011 09:12 PM, Mike Meyer wrote:
Actually, functional programming and the higher math are separate things. Haskell (and I expect the similar languages) have a lot of math in their documentation. But that's not true for other functional languages, like Clojure or Scheme. With a background in those languages, I didn't have much trouble with the functional nature of haskell. But I'm still trying to recall the graduate math courses I took long time ago in a state far, far different from today.
Really? I'll confess I'm a bit surprised to hear that perspective. I don't know anything about Clojure or Scheme. But I found in trying to understand Haskell that it really is all about higher math. Once I finally gave up on "learnyouahaskell" and other ridiculous tutorials, I found the real functional programming textbooks, and discovered that it all starts with lambda calculus; all the explanations are given in set theory notation, with occasionally comparisons to integral and differential calculus for illustration, with very specific rules regarding substitution and reduction and normal forms. I'm still trying to figure out what all those combinators are about! And it is all rested on mathematical proofs, usually inductive.
And that is just the lambda calculus aspect. Then we move on to type theory (!!!) plus the various types of polymorphism, and then on to a number of other topics that I don't know enough about to even mention intelligibly.
-- frigidcode.com theologia.indicium.us
______________________________**_________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/**mailman/listinfo/beginnershttp://www.haskell.org/mailman/listinfo/beginners
-- Michael Xavier http://www.michaelxavier.net LinkedIn http://www.linkedin.com/pub/michael-xavier/13/b02/a26

Christopher Howard
On 09/24/2011 09:12 PM, Mike Meyer wrote:
Actually, functional programming and the higher math are separate things. Haskell (and I expect the similar languages) have a lot of math in their documentation. But that's not true for other functional languages, like Clojure or Scheme. With a background in those languages, I didn't have much trouble with the functional nature of haskell. But I'm still trying to recall the graduate math courses I took long time ago in a state far, far different from today. Really? I'll confess I'm a bit surprised to hear that perspective. I don't know anything about Clojure or Scheme.
In that case, you really don't have any reason for being surprised, do you? It may well be easier to start out with something like 'Structure and Interpretation of Computer Programs' (should be read by every programmer anyway) using Scheme than diving directly into a Haskell text with all the math. But I wouldn't give up on the Haskell texts just yet.
But I found in trying to understand Haskell that it really is all about higher math. Once I finally gave up on "learnyouahaskell" and other ridiculous tutorials, I found the real functional programming textbooks, and discovered that it all starts with lambda calculus; all the explanations are given in set theory notation, with occasionally comparisons to integral and differential calculus for illustration, with very specific rules regarding substitution and reduction and normal forms.
Whereas your typical LISP tutorial will just touch on lambda calculus to explain some of the names being used (like "lambda" and "curry"). On the other hand, 'Real World Haskell' doesn't involve all that much math, either. Nor did what I got through of 'Write yourself a Scheme in 48 Hours' (I switched to RWH because you can find solutions to the exercises in the reader comments). Or did you consider those "ridiculous" tutorials as well?
I'm still trying to figure out what all those combinators are about! And it is all rested on mathematical proofs, usually inductive.
And that is just the lambda calculus aspect. Then we move on to type theory (!!!) plus the various types of polymorphism, and then on to a number of other topics that I don't know enough about to even mention intelligibly.
Yup, I'm still trying to get a handle on that myself. You can get to functional programming without going through that,though. I think I'm going to need those combinators to make the best of Haskell, and I suspect I'll need the math to understand those. But Haskell's large collection of combinator libraries are really no worse than any modern language's library collection (do you "get" all of cpan or pypi or ... ?). That there's a firm mathematical basis behind them just makes them more fun to learn.

On 09/25/2011 03:26 PM, mike.w.meyer@gmail.com wrote:
On the other hand, 'Real World Haskell' doesn't involve all that much math, either. Nor did what I got through of 'Write yourself a Scheme in 48 Hours' (I switched to RWH because you can find solutions to the exercises in the reader comments). Or did you consider those "ridiculous" tutorials as well?
I hated Real World Haskell. IIRC, didn't get into any of the theory, and the "real world" examples didn't seem very real world, either. I should probably clarify... I don't think it is a bad think that Haskell is all about higher math. I just hated the tutorials and books that pretended like this wasn't the case and try to teach you Haskell like you are learning PHP. Personally I find lambda calculus and type theory to be quite interesting and, I suspect, the salvation of the modern programming mess. Unfortunately though they depend on a lot of material I didn't learn in college because the lame C++ OOP courses I was taking gave me the impression that there was zero connection between mathematics and real life programming. -- frigidcode.com theologia.indicium.us

I found Real World Haskell very helpful. After that I could actually program shell scripts in haskell. Then I did Write yourself a Scheme in 48 hours. I could make simple parsers. It is just one step of the stair. But what really helped to move up, was reading research articles in which haskell is featured. The articles are of good quality and very interesting to read. I think that is missing in the tutorials, that there are a lot of good articles about haskell. On Mon, Sep 26, 2011 at 4:47 AM, Christopher Howard < christopher.howard@frigidcode.com> wrote:
On 09/25/2011 03:26 PM, mike.w.meyer@gmail.com wrote:
On the other hand, 'Real World Haskell' doesn't involve all that much math, either. Nor did what I got through of 'Write yourself a Scheme in 48 Hours' (I switched to RWH because you can find solutions to the exercises in the reader comments). Or did you consider those "ridiculous" tutorials as well?
I hated Real World Haskell. IIRC, didn't get into any of the theory, and the "real world" examples didn't seem very real world, either.
I should probably clarify... I don't think it is a bad think that Haskell is all about higher math. I just hated the tutorials and books that pretended like this wasn't the case and try to teach you Haskell like you are learning PHP. Personally I find lambda calculus and type theory to be quite interesting and, I suspect, the salvation of the modern programming mess. Unfortunately though they depend on a lot of material I didn't learn in college because the lame C++ OOP courses I was taking gave me the impression that there was zero connection between mathematics and real life programming.
-- frigidcode.com theologia.indicium.us
______________________________**_________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/**mailman/listinfo/beginnershttp://www.haskell.org/mailman/listinfo/beginners

On Sun, Sep 25, 2011 at 12:45 AM, Christopher Howard
... snip ... Once I finally gave up on "learnyouahaskell" and other ridiculous tutorials, I found the real functional programming textbooks, ...
Can I ask what books these are, and furthermore what makes them more 'real' than LYAH or RWH? I think both of them are quite good for just putting people on their feet and getting them writing code (although RWH can come off as a bit evangelical at times.) These kinds of works certainly are not for everybody, but I'm interested in your definition of 'real' vs 'ridiculous' more than anything, since I think it's very 'real' material for most programmers (I just find it funny because per my own experience, I'd think most people would write off type-theory textbooks as "ridiculous" and "not real", as opposed to material like LYAH/RWH. We'll ignore them, though.) I guess the real question isn't quite where the definitions of 'real' differ, but what you're trying to gain from reading these works. If you really *do* want to know about things like System F, or HM type inference, or the various kinds of polymorphism found in programming languages, then yes, LYAH and RWH are probably 'ridiculous' by those standards - and there are great books on these subjects too, in particular Benjamin Pierce's "Types and Programming Languages." Going back to your initial question, I think the concepts are mostly orthogonal, aren't they? It's hard to know what you're asking. I'm not the biggest web-dev person in existence, but would it not be possible to write a RESTful service in something like Haskell, where your code you wrote is pure and cleanly isolated and all the other stuff we love? You could say programs like XMonad follow the 'MVC' pattern in its own way, as it cleanly separates its model - the internal Zipper data structure - from its view - X11 rendering - from its controller - configuration/input response. Is there some rigid pattern that must be followed closer than this? Or are you thinking about such overall designs that are more 'in tune' with FP and PL research itself? For many questions of this nature, I don't know how much type theory or PL semantics is going to come into the question - it exists in a different strata, it seems. I'm perfectly open to being proven wrong on this point though, since it's more an observation as a result of your question. P.S. Personally, I think it's wonderful we actually have a community (and people like you!) who're interested in taking the time to learn about these topics, for whatever reason. I actually think that much of the subject matter in the field is very rich, yet approachable - speaking from anecdotal evidence as someone who has no higher-math education. -- Regards, Austin

On 09/25/2011 04:37 PM, austin seipp wrote:
On Sun, Sep 25, 2011 at 12:45 AM, Christopher Howard
wrote: ... snip ... Once I finally gave up on "learnyouahaskell" and other ridiculous tutorials, I found the real functional programming textbooks, ...
Can I ask what books these are, and furthermore what makes them more 'real' than LYAH or RWH? I think both of them are quite good for just putting people on their feet and getting them writing code (although RWH can come off as a bit evangelical at times.) These kinds of works certainly are not for everybody, but I'm interested in your definition of 'real' vs 'ridiculous' more than anything, since I think it's very 'real' material for most programmers (I just find it funny because per my own experience, I'd think most people would write off type-theory textbooks as "ridiculous" and "not real", as opposed to material like LYAH/RWH. We'll ignore them, though.)
I guess the real question isn't quite where the definitions of 'real' differ, but what you're trying to gain from reading these works. If you really *do* want to know about things like System F, or HM type inference, or the various kinds of polymorphism found in programming languages, then yes, LYAH and RWH are probably 'ridiculous' by those standards - and there are great books on these subjects too, in particular Benjamin Pierce's "Types and Programming Languages."
The real turning point for me was Davies book "Introduction to Functional Programming" (1992). An oldie, but quite fascinating. I read through about half of it, then went back and begun doing the practice problems. Spent a few days in the Lambda Calculus chapter -- learned a lot and then realized I needed to back up and get into Set Theory and mathematical proofs. Found some other textbooks on Lambda Calculus specifically, including Hankin's "Lambda Calculi" which is pretty good, and (heaven help me) Barendregt's "The Lambda Calculus". Personally, everything I've read about type theory so far has been really fascinating, and I like to jump into it more as soon as I catch up on some other mathematics.
Going back to your initial question, I think the concepts are mostly orthogonal, aren't they? It's hard to know what you're asking. I'm not the biggest web-dev person in existence, but would it not be possible to write a RESTful service in something like Haskell, where your code you wrote is pure and cleanly isolated and all the other stuff we love? You could say programs like XMonad follow the 'MVC' pattern in its own way, as it cleanly separates its model - the internal Zipper data structure - from its view - X11 rendering - from its controller - configuration/input response. Is there some rigid pattern that must be followed closer than this? Or are you thinking about such overall designs that are more 'in tune' with FP and PL research itself? For many questions of this nature, I don't know how much type theory or PL semantics is going to come into the question - it exists in a different strata, it seems.
I don't know the answers to these questions, to be honest. I was hoping for illuminating insight from you Haskell programming geniuses. But yes, I am definitely curious if FP principles can be applied on higher levels than just the compiled code. For example: sure we could rewrite some RESTful service in Functional code, but is REST the best architectural approach that we could be taking?
P.S. Personally, I think it's wonderful we actually have a community (and people like you!) who're interested in taking the time to learn about these topics, for whatever reason. I actually think that much of the subject matter in the field is very rich, yet approachable - speaking from anecdotal evidence as someone who has no higher-math education.
Thanks. -- frigidcode.com theologia.indicium.us
participants (5)
-
austin seipp
-
Christopher Howard
-
edgar klerks
-
Michael Xavier
-
mike.w.meyer@gmail.com