没有合适的资源?快使用搜索试试~ 我知道了~
Beginning Haskell
需积分: 12 107 下载量 40 浏览量
2014-09-20
15:24:11
上传
评论 2
收藏 4.51MB PDF 举报
温馨提示
试读
408页
Haskell的入门教材。书中不仅教授Haskell语言,而且还手把手教读者如何搭建Haskell开发环境。
资源推荐
资源详情
资源评论
Serrano
Mena
Shelve in
Programming Languages/General
User level:
Beginning
www.apress.com
SOURCE CODE ONLINE
RELATED
BOOKS FOR PROFESSIONALS BY PROFESSIONALS
®
Beginning Haskell
Beginning Haskell provides a broad-based introduction to the Haskell language, its libraries and
environment, and to the functional programming paradigm that is fast growing in importance in
the software industry. The book takes a project-based approach to learning the language that is
unified around the building of a web-based storefront. Excellent coverage is given to the Haskell
ecosystem and supporting tools. These include the Cabal build tool for managing projects
and modules, the HUnit and QuickCheck tools for software testing, the Scotty framework for
developing web applications, Persistent and Esqueleto for database access, and also parallel and
distributed programming libraries.
Functional programming is gathering momentum, allowing programmers to express
themselves in a more concise way, reducing boilerplate and increasing the safety of code.
Indeed, mainstream languages such as C# and Java are adopting features from functional
programming, and from languages implementing that paradigm. Haskell is an elegant and noise-
free pure functional language with a long history, having a huge number of library contributors
and an active community. This makes Haskell the best tool for both learning and applying
functional programming, and Beginning Haskell the perfect book to show off the language and
what it can do.
• Takes you through a series of projects showing the different parts of the language
• Provides an overview of the most important libraries and tools in the Haskell ecosystem
• Teaches you how to apply functional patterns in real-world scenarios
What You’ll Learn:
• Build small and large projects using the Haskell language
• Profit from ecosystem tools such as Cabal, HLint, and QuickCheck
• Implement efficient stream I/O via libraries like Conduit
• Parallelize code to run on multiple processors or distributed across a network
• Create domain-specific languages useable by business users, and to tackle specific
problem domains
• Build Haskell-backed websites using database and web-application libraries such as
Persistent, Esqueleto, and Scotty
9781430 262503
54999
ISBN 978-1-4302-6250-3
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
v
Contents at a Glance
About the Author �������������������������������������������������������������������������������������������������������������� xvii
About the Technical Reviewer ������������������������������������������������������������������������������������������� xix
Acknowledgments ������������������������������������������������������������������������������������������������������������� xxi
Introduction ��������������������������������������������������������������������������������������������������������������������� xxiii
Part 1: First Steps ■ ����������������������������������������������������������������������������������������� 1
Chapter 1: Going Functional ■ ����������������������������������������������������������������������������������������������3
Chapter 2: Declaring the Data Model ■ �������������������������������������������������������������������������������15
Chapter 3: Reusing Code Through Lists ■ ���������������������������������������������������������������������������47
Chapter 4: Using Containers and Type Classes ■ ����������������������������������������������������������������77
Chapter 5: Laziness and Infinite Structures ■ ������������������������������������������������������������������111
Part 2: Data Mining ■ ����������������������������������������������������������������������������������� 131
Chapter 6: Knowing Your Clients Using Monads ■ ����������������������������������������������������������133
Chapter 7: More Monads: Now for Recommendations ■ ��������������������������������������������������161
Chapter 8: Working in Several Cores ■ �����������������������������������������������������������������������������187
Part 3: Resource Handling ■ ������������������������������������������������������������������������ 207
Chapter 9: Dealing with Files: IO and Conduit ■ ���������������������������������������������������������������209
Chapter 10: Building and Parsing Text ■ ��������������������������������������������������������������������������235
Chapter 11: Safe Database Access ■ ��������������������������������������������������������������������������������259
Chapter 12: Web Applications ■ ���������������������������������������������������������������������������������������277
■ Contents at a GlanCe
vi
Part 4: Domain Specific Languages ■ ���������������������������������������������������������� 295
Chapter 13: Strong Types for Describing Offers ■ ������������������������������������������������������������297
Chapter 14: Interpreting Offers with Attributes ■ �������������������������������������������������������������331
Part 5: Engineering the Store ■ ������������������������������������������������������������������� 353
Chapter 15: Documenting, Testing, and Verifying ■ ����������������������������������������������������������355
Chapter 16: Architecting Your Application ■ ��������������������������������������������������������������������373
Appendix A: Looking Further ■ �����������������������������������������������������������������������������������������389
Appendix B: Time Traveling with Haskell ■ ����������������������������������������������������������������������391
Index ���������������������������������������������������������������������������������������������������������������������������������393
xxiii
Introduction
Functional programming is gathering momentum. Mainstream languages such as Java and C# are adopting features
from this paradigm; and languages such as Haskell, Scala, Clojure, or OCaml, which embody functional programming
from the very beginning, are being used in industry. Haskell is a noise-free, pure functional language with a long
history, having a huge number of library contributors and an active community. is makes Haskell a great tool for
both learning and applying functional programming.
Why You Should Learn Functional Programming
e rise in functional programming comes from two fronts. Nowadays, most applications are heavily concurrent or
need to be parallelized to perform better. ink of any web server that needs to handle thousands of connections at
the same time. e way you express the intent of your code using Haskell makes it easier to move from a single-thread
application to a multi-threaded one at a negligible cost.
Apart from becoming more concurrent, applications are becoming much larger. You would like your
development environment to help you catch bugs and ensure interoperation between all modules of your system.
Haskell has a very strong type system, which means that you can express a wide range of invariants in your code,
which are checked at compile time. Many of the bugs, which previously would be caught using tests, are now
completely forbidden by the compiler. Refactoring becomes easier, as you can ensure that changes in your code do
not aect those invariants.
Learning functional programming will put you in a much better position as a developer. Functional thinking will
continue permeating through mainstream programming in the near future. You’ll be prepared to develop larger and
faster applications that bring satisfaction to your customers.
Why You Should Read this Book
is book focuses both on the ideas underlying and in the practicalities of Haskell programming. e chapters show
you how to apply functional programming concepts in real-world scenarios. ey also teach you about the tools and
libraries that Haskell provides for each specic task. Newcomers to functional programming will not be the only ones
who will benet from reading this book. Developers of Scala, Clojure, Lisp, or ML will be also able to see what sets
Haskell apart from other languages.
e book revolves around the project of building a web-based strorefront. In each of the ve parts the focus is on
a subsystem of this store: representing clients and products in-memory, data mining (including parallelization and
concurrency), persistent storage, discount and oers, and the general architecture of the application. e topics have
been carefully selected for you to get a glimpse of the whole Haskell ecosystem.
剩余407页未读,继续阅读
资源评论
sjiagc
- 粉丝: 7
- 资源: 53
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功