Nothing Special   »   [go: up one dir, main page]

skip to main content
Skip header Section
Learn You a Haskell for Great Good!: A Beginner's GuideApril 2011
Publisher:
  • No Starch Press
  • 401 China Basin Street Suite 108 San Francisco, CA
  • United States
ISBN:978-1-59327-283-8
Published:18 April 2011
Pages:
400
Skip Bibliometrics Section
Reflects downloads up to 14 Dec 2024Bibliometrics
Skip Abstract Section
Abstract

It's all in the name: Learn You a Haskell for Great Good! is a hilarious, illustrated guide to this complex functional language. Packed with the author's original artwork, pop culture references, and most importantly, useful example code, this book teaches functional fundamentals in a way you never thought possible.You'll start with the kid stuff: basic syntax, recursion, types and type classes. Then once you've got the basics down, the real black belt master-class begins: you'll learn to use applicative functors, monads, zippers, and all the other mythical Haskell constructs you've only read about in storybooks.As you work your way through the author's imaginative (and occasionally insane) examples, you'll learn to: Laugh in the face of side effects as you wield purely functional programming techniques Use the magic of Haskell's "laziness" to play with infinite sets of data Organize your programs by creating your own types, type classes, and modules Use Haskell's elegant input/output system to share the genius of your programs with the outside world Short of eating the author's brain, you will not find a better way to learn this powerful language than reading Learn You a Haskell for Great Good! Excerpt from the Introduction Haskell is fun, and thats what its all about! This book is aimed at people who have experience programming in imperative languagessuch as C++, Java, and Pythonand now want to try out Haskell. But even if you dont have any significant programming experience, Ill bet a smart person like you will be able to follow along and learn Haskell. My first reaction to Haskell was that the language was just too weird. But after getting over that initial hurdle, it was smooth sailing. Even if Haskell seems strange to you at first, dont give up. Learning Haskell is almost like learning to program for the first time all over again. Its fun, and it forces you to think differently. NOTE If you ever get really stuck, the IRC channel #haskell on the freenode network is a great place to ask questions. The people there tend to be nice, patient, and understanding. Theyre a great resource for Haskell newbies. So, What's Haskell? Haskell is a purely functional programming language. In imperative programming languages, you give the computer a sequence of tasks, which it then executes. While executing them, the computer can change state. For instance, you can set the variable a to 5 and then do some stuff that might change the value of a. There are also flow-control structures for executing instructions several times, such as for and while loops. Purely functional programming is different. You dont tell the computer what to doyou tell it what stuff is. For instance, you can tell the computer that the factorial of a number is the product of every integer from 1 to that number or that the sum of a list of numbers is the first number plus the sum of the remaining numbers. You can express both of these operations as functions. Read the Introduction (PDF) in its entirety.

Cited By

  1. Hamid F (2022). A functional programming course in remote learning model, Journal of Computing Sciences in Colleges, 37:6, (36-45), Online publication date: 1-Apr-2022.
  2. ACM
    Delfino T and Ribeiro R Towards certified virtual machine-based regular expression parsing Proceedings of the XXII Brazilian Symposium on Programming Languages, (67-74)
  3. ACM
    Nunes-Harwitt A, Gambogi M and Whitaker T Quick-Sort Proceedings of the 49th ACM Technical Symposium on Computer Science Education, (547-549)
  4. Grzanek K (2016). Monadic Printing Revisited, Journal of Applied Computer Science Methods, 8:1, (69-79), Online publication date: 1-Jun-2016.
  5. Kewley R and McDonnell J Distributed reactive simulation Proceedings of the 2014 Annual Simulation Symposium, (1-5)
  6. ACM
    Tirronen V Study on difficulties and misconceptions with modern type systems Proceedings of the 2014 conference on Innovation & technology in computer science education, (303-308)
  7. Grzanek K (2014). Monadic Tree Print, Journal of Applied Computer Science Methods, 6:2, (147-157), Online publication date: 1-Dec-2014.
  8. ACM
    Lämmel R, Schmorleiz T and Varanovich A The 101haskell Chrestomathy Proceedings of the 25th symposium on Implementation and Application of Functional Languages, (25-36)
  9. Danilenko N Using relations to develop a haskell program for computing maximum bipartite matchings Proceedings of the 13th international conference on Relational and Algebraic Methods in Computer Science, (130-145)
  10. ACM
    Tirronen V and Isomöttönen V Making teaching of programming learning-oriented and learner-directed Proceedings of the 11th Koli Calling International Conference on Computing Education Research, (60-65)
Contributors

Index Terms

  1. Learn You a Haskell for Great Good!: A Beginner's Guide

    Reviews

    Edgar R. Chavez

    Functional programming no longer needs justification. It is a great way to program despite Niklaus Wirth's comments [1]-he groups functional programming among those ideas that, under critical scrutiny, have lost their initial splendor and brilliance. Computer science (CS) students ideally learn functional programming early in the curriculum, and professional programmers benefit from being acquainted with it-it certainly impacts how they think about programming, and they may need to use it at some point in their careers. Since Haskell is becoming the lingua franca of functional programming, it is definitely worth learning. The Haskell Web site (http://www.haskell.org/) recommends this book as the best place to start learning Haskell. The tutorial is also available online (http://learnyouahaskell.com/). It is aimed at readers with previous programming experience. The presentation concentrates on teaching Haskell as a thinking and programming process. Lipova?a occasionally feels the need to contrast concepts from imperative and object-oriented languages with Haskell. This is a great book for self-study. In the CS curriculum, it can serve as an additional resource for learning the language; however, I would not recommend using it as a textbook. Lipova?a expects readers to use the Glasgow Haskell compiler (GHC) and GHC's interactive environment (GHCi) to execute the code shown, but the book's coverage of GHC and GHCi is minimal-just what is needed to load and compile programs. The book is organized into 14 chapters. Input and output (I/O) are covered about halfway through, in chapters 8 and 9. Until then, the code samples are very short; the benefit to this is that the reader can clearly see the points being made. Experienced programmers will note that Haskell can accomplish a great deal in a few lines, yet the code is compact and easy to read. By the time I/O makes an appearance, Lipova?a can show interesting nontrivial examples that take advantage of what was already covered. The wait is worthwhile. For good measure, in chapter 10, Lipova?a explains, in exhaustive detail, the development of two problems: a reverse Polish string calculator, and an attempt to find an optimal path to travel from Heathrow Airport to London. The explanation is straightforward without attempting to be theoretically complete, and then it's back to the nitty-gritty of Haskell and small code segments. This book will provide readers with a solid grounding in Haskell. It covers not only the expected basics, but also some advanced topics. Some sections will require repeated readings-and lots of experimentation with the language. Keep in mind Simon Peyton Jones' insightful comment: "Any language large enough to be useful is dauntingly complex" [2]. The thoughtful reader will wisely follow up with other sources in order to really master the language; the Haskell site has some suggestions along these lines. Regrettably, I must mention several minor shortcomings. The index lacks some entries that should have been included, and a few entries do not correspond to the place where the material is presented. GHCi options are provided as single-letter options; using full names would be better for beginners. Finally, my initial reading of folding (pp. 73-79) left me somewhat baffled-some of the statements need additional explanation or justification. The fact that folding stores deferred computations recursively on a stack is not explicitly mentioned until page 94, when strict left folds are covered. To appreciate the nuances of folds, I recommend Haskell's tutorial (http://www.haskell.org/haskellwiki/Fold) and the links mentioned there. Reading this book is both demanding and fun. I recommend it. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Please enable JavaScript to view thecomments powered by Disqus.

    Recommendations