views:

175

answers:

3

I've heard it's better to read the first edition of "Introduction to Functional Programming" by Bird & Wadler than the second edition. The first edition uses Miranda, and the second edition uses Haskell.

Is this a common recommendation? My goal is to get serious about functional programming. Thoroughly knowing the concepts of functional programming is more important to me than knowing a language's syntax, so I'm fine with learning Miranda if the first edition is somehow better.

I know F# and Scala.

+1  A: 

I used Haskell, it is a purely functional language and it is pretty standard. I don't remember Miranda very well but I think that is not purely functional, same as F# and Scala. My sugestion is learn the pure way, it is probaly the hardest but don't take any shortcut with functional programming, that way you will never learn it as it's finest. And as far as I know, Miranda has very little adoption and Haskell has grown steadly over the years.

Ither
I don't know Miranda either, but Wikipedia disagrees with you, says it's purely functional.
keegan
Thanks for your thoughts. Yes, as keegan says, Miranda is purely functional. To clarify, I wasn't asking if I should learn Miranda over Haskell, but rather should I read the 1st or 2nd edition of that book. It doesn't matter to me what language is used, as I plan to learn concepts rather than syntax.
Slack
+1  A: 

I haven't read Bird & Wadler, but Miranda and Haskell are similar--purely functional, nonstrict, statically typed, etc. If language is your only consideration when choosing the edition, I'd choose Haskell because it's more popular and free, and hence easier to get hands-on experience with.

I haven't used Miranda, but my understanding is that it's the primary predecessor to Haskell and that Haskell would not have existed unless its creator had closed the source and tried to make it a commercial product. It's still referred to as MirandaTM sometimes because of this.

Nathan Sanders
This is rather unfair. Miranda was developed in the 80's when there wasn't the notion of "open source languages" (Miranda was released in 1985 the same year as GCC). There were a number of commercial implementations of advanced languages and I think Miranda was probably one of the more successful ones. With the rise of Linux and also Java (closed-source, free to use, hugely sponsored) the environment changed, and its ungracious to judge Miranda in this new context. David Turner's work on Miranda invented a lot of features taken for granted by Haskell, his contribution to programming is huge.
Stephen Tetley
@Stephen Tetley: Regardless of whether it is fair to imply that Miranda "should have been" open source (which Nathan didn't assert), I think it is fair to speculate that if Miranda _had_ been opened (regardless of how unconventional it would have been at the time to do so), Haskell quite possibly would not have come into being - Miranda would very likely have been adapted to fill the same niche. The fact that it would've been radical to do something doesn't invalidate speculation about what would be different today if it had been done.
mokus
@mokus: This is precisely the case: the rest of the FP community agreed on Haskell as a committee project because the best candidate, Miranda, was no longer available for academic use. Miranda did not run afoul of the ideals of the Free Software community, but against the practise of academia. (The resemblance of the two is strong, of course.)
Nathan Sanders
@Nathan Sanders. No, again this is inaccurate and interpreting the past through contemporary mores. Please read sections 2.2 and 2.3 of "The History of Haskell" - nowhere does it mention that Miranda was "taken away from the commons", if you have evidence to the contary please provide a reference. http://research.microsoft.com/en-us/um/people/simonpj/papers/history-of-haskell/history.pdf
Stephen Tetley
@Stephen: The paper you linked is where I learned most of the history around Haskell and Miranda. Sections 2.2 and 2.3 are overviews. For Miranda, see section 3.8, particularly the paragraph at the top of page 11, column 2. It starts "Miranda's proprietary status did not enjoy universal support in the academic community". It goes on to talk about the MirandaTM issue.
Nathan Sanders
@Nathan "Miranda's proprietary status did not enjoy universal support in the academic community", true - but David Turner did all the work designing and implementing Miranda so he gets to call the shots, no? Also, asking to put Miranda in the public domain as some people evidently did, well its easy to do the asking when you didn't do the work. Incidentally sction 3.8 of HoH has been substantially revised, earlier drafts didn't have the 'what-if' paragraph or mention the TM issue. Apologies if my first message was curt, but SO has char-limits on below-the-line comments, so I had to cut a lot.
Stephen Tetley
+4  A: 

I strongly recommend the second edition, which is an extensively revised, extended and mostly improved revision of the first edition. I have read both editions. The first edition has an example on solving the 8 queens problem with backtracking, unfortunately this example was dropped in the second edition. The second edition is my favourite book on Haskell.

The examples are from mathematics, including proof by induction. The material on deriving programs from their specifications by Bird in the second edition is awesome, I love this book. If you can handle examples from maths, this book is superb.

I think this book is also a great introductory text on Haskell, however I found that as soon as I tried writing Haskell programs that I often had to read material from other tutorials, and kept having to refer to Real World Haskell.

Another great text on mathematics and logic, with examples using Haskell that helps to understand the maths, is the Haskell Road to Logic, Maths and Programming. Bird's text goes much deeper on Haskell programming.

gienah