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
《平面设计视觉词典》旨在对平面设计中容易混淆的一些专业词汇予以区别和解释,比如斜线和斜体的区别,重印、套印、翻转的区别等
《数字与模拟通信系统》(第7版)在前六版的基础上改编而成,系统地介绍了现代通信系统的基本理论和最新发展技术。全书共分8章,内
《运动是最好的心药:心血管疾病运动治疗策略》内容简介:运动有益健康的理念深入人心,对于健康人群,多数的运动项目是安全有益的
《黄金白银投资与理财》内容简介:本书从认识黄金和白银的特性入手,分析了黄金以及白银的金属属性和货币属性,阐述了黄金与白银市
《张洁文集·散文随笔卷》内容简介:《散文随笔卷》在阅读过程中不仅能品味这些佳作的散文随笔卷思想性、艺术性,而且还能从中明白
《4000年中国天文史》内容简介:天文学是个古老的基础学科,古人以“上知天文下知地理”作为认知的标准,观测星空更是人类迈出认识
《人人可懂的深度学习》内容简介:采用通俗易懂的语言,简明而全面地介绍对人工智能革命起到核心作用的深度学习技术。作者:【爱尔
CharlesPetzold从1984年开始编写个人计算机程序,从1985年开始编写MicrososftWindows程序。他在《MicrosoftSystem...
偏微分与变分技术在图像分割中的应用研究 内容简介 本书总结了笔者近年来在图像分割方面的研究成果, 主要介绍了基于变分水平集的分割技术及其应用, 并在对该领域基本...
《马克思主义异化理论的当代诠释》内容简介:异化概念贯穿马克思思想体系发展的始终,马克思的异化理论对于社会现象和问题一直具有
《决胜移动终端》内容简介:•在移动互联时代,拥有移动终端的消费者不再需要“去购物”,他们随时随地都“在购物”。这就给企业带来
作者简介:JohnResigjQuery之父,世界级Web开发大师。2007年加入Mozilla公司,现为可汗学院开发人员。RussFerguson资深开发人员...
Theworldofhealthcareisconstantlyevolving,everincreasingincomplexity,costs,andsta...
机械CAD/CAM技术-第3版 内容简介 本书系统地讲述了机械cad/cam的基本概念、应用方法和关键技术。主要内容包括cad/cam系统工作原理、软硬件支撑环...
《唐人佚诗解读》内容简介:本书主要内容包括诗人王绩的两种文集及其佚诗,贺知章的醉与醒,元结与《箧中集》作者之佚诗,张志和《
本书的特点是:代替价多复杂的数学推导过程,给出了一系列简明的计算公式;避免了纯粹的理论叙述,给出了大量的设计实例;从系统
阿列克西的著作探讨的主要问题是如法律裁决之类的规范性陈述如何以理性的方式证立。阿列克西将规范性陈述的证立过程看作实践商谈
《汽车维修从入门到精通(彩色图解+视频)》内容简介:本书按照汽车维修人员的认知规律从易到难介绍了汽车维修的有关知识,包括汽车
《数码单反摄影从入门到精通(畅销升级版)》内容简介:本书共分为4篇21章,向读者全面而深刻地展示了单反摄影各方面的知识和具体实
《白孔雀》内容简介:“劳伦斯经典系列”由《儿子与情人》《恋爱中的女人》《骑马出走的女人》《白孔雀》四本组成,由国内劳伦斯研