This fast-moving guide introduces web application development with Haskell and Yesod, a potent language/framework combination that supports high-performing applications that are modular, type-safe, and concise. You’ll work with several samples to explore the way Yesod handles widgets, forms, persistence, and RESTful content. You also get an introduction to various Haskell tools to supplement your basic knowledge of the language.
By the time you finish this book, you’ll create a production-quality web application with Yesod’s ready-to-use scaffolding. You’ll also examine several real-world examples, including a blog, a wiki, a JSON web service, and a Sphinx search server.
Build a simple application to learn Yesod’s foundation datatype and Web Application Interface (WAI)
Use Shakespearean template languages for HTML, CSS, and Javascript output
Produce cleaner, more modular code by learning how Yesod monads interact
Implement the yesod-form declarative API to build forms on top of widgets
Learn how Yesod and Haskell store session data and handle persistence
Use techniques to serve an HTML page and a machine-friendly JSON page from the same URL
Create reusable components for several applications with Yesod subsites
Basics
Chapter 1 Introduction
Type Safety
Concise
Performance
Modular
A Solid Foundation
Introduction to Haskell
Chapter 2 Haskell
Terminology
Tools
Language Pragmas
Overloaded Strings
Type Families
Template Haskell
QuasiQuotes
Summary
Chapter 3 Basics
Hello World
Routing
Handler Function
The Foundation
Running
Resources and Type-Safe URLs
The Scaffolded Site
Development Server
Summary
Chapter 4 Shakespearean Templates
Synopsis
Types
Syntax
Calling Shakespeare
Other Shakespeare
General Recommendations
Chapter 5 Widgets
Synopsis
What’s in a Widget?
Constructing Widgets
Combining Widgets
Generate IDs
whamlet
Using Widgets
Summary
Chapter 6 Yesod Typeclass
Rendering and Parsing URLs
defaultLayout
Custom Error Pages
External CSS and JavaScript
Smarter Static Files
Authentication/Authorization
Some Simple Settings
Summary
Chapter 7 Routing and Handlers
Route Syntax
Dispatch
The Handler Monad
Summary
Chapter 8 Forms
Synopsis
Kinds of Forms
Types
Converting
Create AForms
Validation
More Sophisticated Fields
Running Forms
i18n
Monadic Forms
Input Forms
Custom Fields
Summary
Chapter 9 Sessions
Clientsession
Controlling Sessions
Session Operations
Messages
Ultimate Destination
Summary
Chapter 10 Persistent
Synopsis
Solving the Boundary Issue
Migrations
Uniqueness
Queries
Manipulation
Attributes
Relations
Closer Look at Types
Custom Fields
Persistent: Raw SQL
Integration with Yesod
Summary
Chapter 11 Deploying Your Webapp
Compiling
Warp
FastCGI
Desktop
CGI on Apache
FastCGI on lighttpd
CGI on lighttpd
Advanced
Chapter 12 RESTful Content
Request Methods
Representations
Other Request Headers
Stateless
Summary
Chapter 13 Yesod’s Monads
Monad Transformers
The Three Transformers
Example: Database-Driven Navbar
Example: Request Information
Summary
Chapter 14 Authentication and Authorization
Overview
Authenticate Me
Authorization
Conclusion
Chapter 15 Scaffolding and the Site Template
How to Scaffold
File Structure
widgetFile
defaultLayout
Static Files
Conclusion
Chapter 16 Internationalization
Synopsis
Overview
Message Files
RenderMessage Typeclass
Interpolation
Phrases, Not Words
Chapter 17 Creating a Subsite
Hello World
Examples
Chapter 18 Blog: i18n, Authentication, Authorization, and Database
Chapter 19 Wiki: Markdown, Chat Subsite, Event Source
Chapter 20 JSON Web Service
Server
Client
Chapter 21 Case Study: Sphinx-Based Search
Sphinx Setup
Basic Yesod Setup
Searching
Streaming xmlpipe Output
Full Code
Appendices
Appendix monad-control
Overview
Intuition
Types
Real Life Examples
Lost State
More Complicated Cases
Appendix Conduit
Conduits in Five Minutes
Structure of This Chapter
The Resource Monad Transformer
Source
Sinks
Conduit
Buffering
Appendix Web Application Interface
The Interface
Hello World
Middleware
Appendix Settings Types
Appendix http-conduit
Synopsis
Concepts
Request
Manager
Response
http and httpLbs
Appendix xml-conduit
Synopsis
Types
Text.XML
Cursor
xml-hamlet
xml2html
《时装设计元素:面料与设计》首先对时装面料史做了简单的介绍,然后描述了织物的设计过程,包括理论上的和一直持续到今天的有关织
《中国式资本市场、公司治理与企业发展》内容简介:中国资本市场三十年的发展历史,既是可歌可泣、波澜壮阔的伟大历史,同时也是摸
《跟老男孩学Linux运维:高性能Web集群实践(上)》内容简介:全书共分为12个章节(0—11章)第0章,讲解CentOS7.6操作系统的安装。
《如何让你的销售增加369%:引导式销售技巧》内容简介:如何增加销售是每一个企业关注的话题,本书详细介绍了可以大幅提升销售的引
Asupremelyusablenuts-and-boltsguideforbeginnersAdailytoolofthetradeforspecialist...
《行摄!肯尼亚!》内容简介:《行摄!肯尼亚!》以作者的亲历行程为主线,介绍了肯尼亚各地区的风土人情、野生动物、自然风光,并
錢研發的高科技產品,為何九五%都是賠錢貨?錢景?還是陷阱?九組關鍵準則,判讀最值得投資的高科技產業。對創造、投資新科技的
《食品雕刻项目化教程》内容简介:《食品雕刻项目化教程》基于“项目引导、任务驱动”的项目化教学方式编写,体现“学以致用”、“
《媒商十堂课》内容简介:世界上只有2%的人意识到,他们的一言一行,一颦一笑,都在作为重要的信息构建着独一无二的“个人”品牌。
《跨境电商运营从基础到实践》内容简介:跨境电商案例,系统、全面地介绍了跨境电商的理论与实际操作,内容包括走进跨境电商、跨境
《坚守坐拥的书城》内容简介:学者不管怎么挣扎,都自有他的“不自由”,那就是无论如何也舍不得离开他的书。可“坐拥书城”也自有
《自己动手写Docker》内容简介:《自己动手写Docker》在详细分析Docker所依赖的技术栈的基础上,一步一步地通过代码实例,让读者可
[内容简介] 大数据时代的来临,给当今的商业带来了极大的冲击,多数电商人无不“谈大数据色变”,并呈现出一种观望、迷茫、手足
《SQL解惑(第2版)》中收集了75个与SQL编程相关的有趣问题,涉及数据库应用的许多方面,如财务、投资、旅游、销售、计算等,不一而
CSS是层叠样式表的简称,通过它可控制网页样式并允许将样式信息与网页内容分离。《CSS终极参考手册》是CSS的最佳参考书籍,共18章
EDIUS 6视频处理实用教程 本书特色 《EDIUS6视频处理实用教程(高等学校十二五计算机规划教材)》由马建党编著,共分7个章节。第1章是对EDIUS软件的...
《企业品牌管理案例》内容简介:本教材将通过解剖案例的方式,阐述企业品牌管理中的诸多知识点,涉及品牌的概念与要素、品牌战略定
罗振宇、丹尼尔•平克、赛斯•高汀、丹•艾瑞里、谢家华、阿里安娜•赫芬顿强烈推荐!美国亚马逊2013年年度商业&投资类图书榜前20名!
《Kubernetes实战:构建生产级应用平台》内容简介:本书探讨了通往Kubernetes生产环境成功道路中所涉及的多种技术、模式和抽象方面
CrossSiteScriptingAttacksstartsbydefiningthetermsandlayingoutthegroundwork.Itass...