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
《狂想曲:克苏鲁趣味角色插画图鉴》内容简介:如果用萌趣的风格来表现克苏鲁神话中恐怖奇异的角色,会是怎样的效果呢?如果你抱着
操作系统 内容简介 本书以UNIX操作系统为背景,介绍了操作系统的基本知识,全书包括九章内容,概述了操作系统的定义、功能、特征、发展历程、主要类型及用户界面,以...
在学校、学院中,在工业、零售业与大众媒体领域中,设计这个话题,变得越来越热门。数年来在英国政府不温不火的支持中,也大大提
计算机科学概论(刘艺) 本书特色 《计算机科学概论》可作为大学本科"计算机基础"课程教材,也可供自学人员参考使用。为更好地反映*近几年计算机学科的发展现状,作者...
《庆历四年秋》内容简介:“庆历四年春”,这是范仲淹千古经典《岳阳楼记》起首句所定格的不朽时间。宋仁宗庆历四年,这段貌似短暂
《朱子哲学思想的发展与完成》内容简介:本书剖析了集宋代理学之大成的朱熹的学思内涵,比较集中地体现了刘述先先生关于宋明儒学研
《明诗鉴赏》内容简介:《明诗鉴赏》是“新选中国名诗1000首”丛书中的一种,是由首都师范大学教育部长江学者特聘教授左东岭注评。
《郭沫若散文》内容简介:郭沫若一生涉足广泛、著作甚丰。他的散文气势浩荡,清丽、浪漫,富有艺术魅力。自传性构成了郭沫若散文明
《销售团队没业绩,如何激励?》内容简介:企业生产的产品或服务能够被用户认可,销售团队起着至关重要的作用;同时销售团队的业绩
移动互联网时代的工作 本书特色 本书介绍移动互联时代下移动工作和移动办公的趋势、方法、工具和资源,全书分为工作的革命和移动工作的应用两篇,共包含 8部分内容,主...
本书是极负盛名的C语言入门经典教材,其第一版发行至今已有20年的历史。本书内容详实全面,由浅入深,示例丰富,并在每个章节后面
插画师是绘制广泛用于各种场合的图画的专业绘画人员。有时,插画师会碰到一些从未想过,从来接触过,也没有任何经验的插画委托。
本书全面考察了1960-1975年荷兰社会经济的环境下视觉识别的设计者(如设计公司、自由设计师)、客户(如企业、政府、公共机构)、执行
BIO(生态,有机)一词已经越来越多的出现在大众视野。蔬菜水果要吃BIO的,蜂蜜果酱要买BIO的,甚至护肤品都有BIO的。《生态花园
天亮了一只鸟落在船上蝴蝶从水面飞过湖畔边的蜘蛛网里,一只蜘蛛正在和天牛扭打野鸭悠然自得地从水面游走傍晚了月亮倒映在湖面上
《配色宝典》是一本集配色理论和配色实例为一体的便携式工具书。配色理论部分以日本视觉设计研究所研发的色立体为基础,将色彩分
《网店运营与管理实务》内容简介:本书以就业为导向,以能力为本位,采用项目任务驱动的体例,每个项目以具体任务为主线展开,每个
《若到江南赶上春》内容简介:本书是吴浩然漫画作品的合集,每幅画作配以简短文字阐述画面,延续丰子恺轻松、风雅、有趣的风格,展
《赤子:余光中散文》内容简介:收录当代散文大师余光中的散文代表作,横跨诗歌、散文、评论、翻译四维写作空间,尽显一代文豪刚柔
《新少儿小提琴集体课教程 第六册》内容简介:本教程里充满了音乐材料,从一开始到结束,都是大家熟知的民间音调和国外音乐材料,很