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
《正蒙释 正蒙辑释》内容简介:本书是明代高攀龙《正蒙集注》和徐必达《正蒙发明》的合刻本,但《正蒙释》并非是二书的简单相加。徐
《天人合一》内容简介:“天人合一”由宋代著名思想张载明确提出,是中国传统思想中经久不衰的思想话题,集中体现了人与自然和谐相
《个性:极简庄子》内容简介:王蒙写给年轻人的中国智慧读本,凝聚数十年读书心得与人生经验,直达《庄子》精华内核。在本书中,王
《精神科医生破案笔记2:青山医院之谜》内容简介:1、诡异之地,进入必疯!每一种疯狂试探的背后,都是破碎的灵魂、病态的躯体; 2
《中国人力资源法律审计报告2018——从东盟十国看“一带一路”国家的劳动与雇佣管制》内容简介:本报告是“中国人力资源审计系列报
空间信息智能服务理论与方法 本书特色 《空间信息智能服务理论与方法》共分10章。为了给读者阅读空间信息服务作相关知识铺垫,本书第1章、第2章分别阐述了网络服务的...
大多数记载个人电脑产业发展史的作品将个人电脑视为一种技术或者商业行为。但本书处处笔酣墨饱,深入探讨了催生第一台个人电脑的
《餐饮中的设计》有别于家庭和工作场所,餐厅就犹如一个第三空间,是个人的避难所,更是社交聚会的好去处。在高速公路看到餐馆标
《电力储能用锂离子电池技术》内容简介:本书在中国电力科学研究院有限公司首席技术专家惠东主持下,组织北京理工大学、上海交通大
《面向21世纪高等学校信息工程类专业规划教材·通信系统概论》共有8章内容,包括绪论、数字通信系统、多媒体通信系统、通信网络系
《次世代游戏机械及场景制作》内容简介:次世代游戏曾经是高端游戏的代名词,只出现在街机和高端电视游戏主机上,而随着游戏环境软
《你若安好 便是晴天:林徽因传》内容简介:邂逅一个人,只需片刻,爱上一个人,往往会是一生。她是诗人、作家、建筑师,是人民英雄
《FFmpeg音视频开发基础与实战》内容简介:全书内容分为三部分,共15章。第1~6章为第一部分,主要讲解音视频开发的基础知识,简要介
《基于4G系统的移动服务技术》介绍了构建一种前所未有的新的业务提供的方法学、解决方案以及富有前景的深入视角。通过对未来网络
MATLAB数学建模经典案例实战 本书特色《matlab数学建模经典案例实战》全面、系统地讲解了数学建模的知识。书中结合历年全国大学生数学建模竞赛试题,采用案例...
《插画设计高级教程Illustration》以国际的视角检验了现代插画艺术中插画题材的运用尺度,并提供了制作一件插画作品所需的理论及
《将战略落地:重新定义目标驱动与执行》内容简介:本书旨在指导和帮助企业实现战略落地。作者以企业管理顾问的角色,在数十年的管
《女性择偶倾向》内容简介:择偶作为一种复杂的社会、文化和心理现象,近年来已成为社会学与心理学炙手可热的研究课题。西方*早展开
人类历史上每隔一段时间就会出现新的“革命”,每次“革命”都伴随着创造巨富的机会。经济的最终目的是不断地追求公平和效率,而
您想源源不断地汲取创作灵感并极大地提高工作效率吗?《中文版PhotoshopCS5技法精粹:以假乱真的艺术(第6版)》将助您实现这一梦