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
《不教一日闲过:回忆齐白石》内容简介:齐白石是融诗、书、画、印为一体的艺术大师,是二十世纪唯一被选为世界文化名人的中国艺术
李永志管理3000人的客户服务团队,集团级内训师,承担客户运营管理、落实工作,实战经验丰富。从基层的集团客户管理员做起,到VI
《幻想即现实(十周年珍藏版)》内容简介:幻想是内心的现实,你的世界是什么样子,与你有关,与世界无关。本书源于治疗过程,是作
缪哲在艺术史学者的书房里,欧文·琼斯(OwenJones,1809-1874)的《装饰的语法》(TheGrammarofOrnament)与《中国装饰集锦》(
《近代安徽族田研究》内容简介:本书对近代安徽族田进行较为系统全面的研究,主要是从清代、民国时期政府族田政策的变迁和族田助学
《宋词三百首品读》内容简介:《宋词三百首》是晚清词人朱祖谋所编的一本脍炙人口的经典宋词选本,广为读者接受和喜爱。本书即华东
《赋权富民(全2册)》内容简介:本书为我国农村问题研究学者张英洪在2012—2016年撰写和发表的有关“三农”问题研究的文章自选集,
《网页设计创意书(卷2)》是《网页设计创意书》的卷2,但并非其简单补充,而是作者基于近几年网站发展新趋势的再创作。《网页设计
《网络与通信技术百科全书》是一本关于网络技术和通信技术的百科全书,内容涉及了到目前为止网络与通信方面的各种技术和应用。《
《投资大白话》内容简介:一本让股市小白看得懂的书,一本值得投资老手重视的书。用人人都听得懂的话阐明股市投资的真谛,让人人都
JavaScript和Java这两大生态系统之间如何协同,成为所有Web开发人员共同面临的问题。本书应运而生,全面又简练地为读者展示了最新
《现代数字信号处理》全面、系统、深入地讨论了现代数字信号处理的理论、设计和应用。全书由自成体系而又有联系的八章组成,分别
《图形设计新元素》一书提出了一些平面设计研究领域迫切需要关注的新问题。埃伦勒普顿(EllenLupton)是《字体思维》(Thinkingwith
本书系统地讨论了数字信号处理的基本理论、基本算法和基本实现方法,注重基本概念、基本方法的讲解,压缩了繁琐的理论推导;注重
本书是一本完整的、基于最佳实践的JavaScript敏捷测试指南,同时又有着测试驱动开发方法(TDD)所带来的质量保证。领先一步的Jav
本书是机器学习原理和算法编码实现的基础性读物,内容分为两大主线:单个算法的原理讲解和机器学习理论的发展变迁。算法除包含传
《互联网营销:理念的颠覆与蜕变》内容简介:这本书把互联网商业的新营销思维,简要地归纳为四个英文字母SURE,分别代表口碑扩散(
《脑卒中:与时间赛跑》内容简介:一定要知道的脑卒中预防与康复知识,上海交通大学医学院附属瑞金医院康复团队暖心制作。全书通过
观念是一切的开始,本书汇集了那些正在影响和创造着未来时尚潮流的观念。20世纪是一个充满创新的时代,其中许多创意给女性服饰带
《动静之美》内容简介:《动静之美——Sketch移动UI与交互动效设计详解》全面、细致地介绍了Sketch软件的使用方法,以及和Sketch软