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
本书系统地阐述了网络的基本概念,并指导你如何用C语言实现。同时描述了Linux网络的全貌,解释了Linux代码是如何工作的,主要网络
《物联网安装调试与运维(初级)》内容简介:本书是1+X职业技能等级证书——物联网安装调试与运维(初级)的配套图书。本书在编写思
Inthisbook,notedwebdeveloperandlongtimeWaSPmemberJohnAllsopteachesallyouneedtokn...
《生育制度》内容简介:《生育制度》是费孝通1946年根据他在西南联大和云南大学任教时的讲义整理而成,围绕“家庭三角”这一核心议
Solid Edge高级篇 本书特色 本书以EDS公司*新版本的SolidEdge为内容编写而成。本套丛书分为《SolidEdge基础教程》、SolidEdge...
《儿童身体训练动作手册:弹力带训练》内容简介:“儿童身体训练动作指导丛书”共7册,是中国青少年体能训练师认证参考教材,并得到
《反正都能飞(李长声自选集)》内容简介:本书系旅日华人作家李长声自选集中的文学及出版篇。作者在此卷所选文章中,对日本文学史
《荷塘月色:朱自清精读》内容简介:《荷塘月色:朱自清精读》是“壹本”系列之一,从当下读者爱读、想读和需要读的角度,精选著名
时至今日,Linux系统已经从一个个人作品发展为可以用于各种关键任务的成熟、高效和稳定的操作系统,因为具备跨平台、开源、支持众
《支付方法论》内容简介:这是一部从产品、运营、业务、技术4个维度全面讲解支付理论与实操的著作。详细阐述了如何通过支付系统建设
《信号与系统(上册)(第2版)》是1981年出版《信号与系统》(高等教育出版社出版)的修订版。本版与第一版的结构层次大体相同,仍然
《团体心理游戏256例》内容简介:心理游戏是一种在团体情境中提供心理帮助与指导的重要方式,它是通过团体内人际交互,促使个体在人
《构建高性能Web站点》内容简介:本书围绕如何构建高性能Web站点,从多个方面、多个角度进行了全面的阐述,涵盖了Web站点性能优化的
CG进阶-SAI+Photoshop女性动漫角色绘制技法-含DVD 本书特色 吴博编著的《CG进阶(SAI+Photoshop女性动漫角色绘制技法)》详细介绍了...
《趣学Python算法100例》内容简介:本书从一些经典算法出发,为读者展示了100个Python趣味编程实例。本书共12章,涵盖趣味算法入门
《安德森18首长笛练习曲 OP.41》内容简介:安德森长笛练习曲系列教程是欧美地区针对长笛演奏使用很普遍的一套教材,在长笛技巧性的
性能是任何一个网站成功的关键,然而,如今日益丰富的内容和大量使用Ajax的Web应用程序已迫使浏览器达到其处理能力的极限。Steve
《小池大鱼》内容简介:不是每个企业都可以成为行业龙头。一些聪明的企业,会在细分市场做垂度和深度,做小池塘里的大鱼,进而成为
《前端性能揭秘》内容简介:本书主要介绍用于指导前端性能优化工作的通用优化方法,从网络、浏览器、构建工具、跨端技术和CDN等方面
《区块链核心算法解析》内容简介:《区块链核心算法解析》介绍了构建容错的分布式系统所需的基础技术,以及一系列允许容错的协议和