Learn You a Haskell for Great Good!

Miran Lipovaca

出版时间

2010-01-01

ISBN

9781593272838

评分

★★★★★

标签

编程

书籍介绍
这本书最大的特点,是它把「函数式编程」这个容易让人望而生畏的领域,讲得像一篇长篇冷笑话。作者用大量流行文化梗、自嘲式插图和口语化表达,把 Functor、Monoid、Monad 这些抽象概念串成一条循序渐进的路径——很多读者都说,这是他们理解 Monad 的「最合理一次」。它不追求大而全,刻意避开了网络、数据库这类工程内容,把力气花在把核心直觉讲透。正因如此,它也引发争议:有人嫌它太浅、内容不够系统,也有人恰恰因为它「有趣又清晰」而反复重读。它适合已经接触过 C++、Java、Python 这类命令式语言、想要真正理解函数式思维,却又不想被学术化表述劝退的读者。
作者简介
Miran Lipovaca is a computer science student in Ljubljana, Slovenia. His online tutorial, "Learn You a Haskell for Great Good!," is widely regarded as the best way to learn Haskell.
AI导读
核心看点
  • 幽默风趣的插图与文风,降低学习门槛
  • 从基础语法到Monad,循序渐进讲解核心概念
  • 适合有命令式编程经验的读者入门函数式编程
读者共识
  • 公认最好的Haskell入门书,讲解清晰且生动
  • 相比Real World Haskell更易懂,适合新手起步
  • 部分读者认为内容略显拖沓,进阶深度稍显不足
精彩摘录
  • "我们看到如何在函子值上映射“多参数”函数得到函数值的函子值。我们能对它做什么吗?对于一个参数,我们可以映射一个函数,它接受某个函数为参数,给这个函数应用一个参数。因为函子值里的任何东西都会被作为参数传递给我们的函数。"
  • "_ means that we don't care what we'll draw from the list anyway so instead of writing a variable name that we'll never use, we just write _."
  • "Use tuples when you know in advance how many components some piece of data should have. Tuples are much more rigid because each different size of tuple is its own type, so you can't write a general function to append an element to a tuple — you'd have to write a function for appending to a pair, one"
  • "In our gcd' function, the logging is fast because the list appending ends up looking like this: a ++ (b ++ (c ++ (d ++ (e ++ f)))) Lists are a data structure that's constructed from left to right, and this is efficient because we first fully construct the left part of a list and only then add a long"
  • "Function application has the highest precedence of all the operations in Haskell. In other words, these two statements are equivalent."
  • "This example introduces Haskell’s if statement. You’re probably already familiar with if statements from other languages, but what makes Haskell’s unique is that the else part is mandatory. On the other hand, a Haskell program is a collection of functions. Func- tions are used to transform data valu"
  • "Accessing List Elements If you want to get an element of a list by index, use the !! operator. As with most programming languages, the indices start at 0:"
  • "multThree :: Int -> Int -> Int -> Int multThree x y z = x * y * z"
目录
Introduction
Chapter 1: Starting Out
Chapter 2: Believe the Type
Chapter 3: Syntax in Functions
Chapter 4: Hello Recursion!

显示全部
用户评论
必须推荐,学FP的绝佳入门语言和教程。
我读过最好的Haskell入门。内容不如Real World Haskell丰富,没有介绍网络和数据库等,但基础内容全面而且清晰易懂。Functor->Monoid->Monad的进阶也是目前我觉得了解Monad最合理的路径。
草。。。读到lambda真出来个freeman半身像。。。
起初跟 Real World Haskell 同时看的,后来索性先把他看完!
文风很幽默,讲解也很到位,简洁清晰。这本小书比Real World Haskell好懂。缺点是内容不够全面和深入。fold的用法也有错误,email给作者,他也已经意识到了这一点。
看得我稀里糊涂的,其实没理解。感觉讲得太浅了。
太棒了,学haskell就靠它看懂了
比我读过的所有Haskell中文教材好读十万甚至九万倍
再一次入门 Haskell。文风亲切,画风可爱,讲解得挺细致(对有经验的人来说算拖沓了)。不过离现代 Haskell 还挺远,只能算新手了解下 Haskell 风格用。
只读了前半部分,清晰易懂
下载
收藏