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
图像超分辨率技术及其应用 内容简介 《图像超分辨率技术及其应用》主要论述了图像超分辨率技术,即从单幅或多幅低分辨率图像获取高分辨率图像。尽管已有的图像插值和超分...
《基于Selenium WebDriver和Cucumber》内容简介:从目前主流的Web自动化测试工具入手,由浅入深、全面、细致地阐述了如何使用开源测
《网页配色实用手册》在日常生活中,色彩早已广泛地深入到人们的精神生活和物质生活中,它是一种能够激发情感、刺激感官的重要元
《诗歌课的25个瞬间》内容简介:本书立志于填补童诗教学的盲点,通过引进古诗做参照物,在生活中发现大量童诗写作的题材。此外,本
ORACLE11G宝典 本书特色 《Oracle 11g宝典》按照管理、应用、理解的需要,循序渐进地,完备地描述Oracle 11g的特征和功能,并在Oracl...
版式设计原理,ISBN:9787500677390,作者:(日)佐佐木刚士目录 第1章页面构成的理论总觉得效果有点奇怪根据理论修改之后Spec
《钗黛之辨》内容简介:《红楼梦》问世至今二百多年来,在众口一词给予了最高的赞誉的同时,又几乎在所有的问题上都存在着种种不同
《分配正义新论:人道与公平》内容简介:当今的分配正义理论主要是义务论的。这种义务论分配正义理论一方面或多或少受到康德伦理思
高级数据结构 本书特色 《高级数据结构》在基本数据结构的基础上,围绕一些常用的高级数据结构,结合大量实战例题,深入分析“数据结构是如何服务于算法的”。内容包括:...
虽然《我是猫》为人熟知,但未必被大家仔细读过。为了让读者能重拾它的独特之美,Graphic社计划为此书重新装帧,并集结出版,因此
《Excel 2010办公应用实战从入门到精通(超值版)》内容简介:《Excel 2010办公应用实战从入门到精通(超值版)》通过精选案例引导
《汽车材料及轻量化趋势》内容简介:作为提高汽车燃油经济性的手段之一,轻量化并不是新鲜的技术名词。从20世纪70年代以来,汽车轻
《绘生活 会生活》内容简介:这是一本教您用心绘出生活中的美好与感动的书,同时也传递给您一种对待生活的积极态度。本书中没有过多
本书描述的是在逆向与反逆向之间展开的一场旷日持久的拉锯战。作者EldadEilam以一个解说人的身份为我们详尽地评述了双方使用的每
《手把手教你学C语言》内容简介:本书是学习C语言的入门书籍,内容非常全面,包含C语言基础知识、流程控制、数组、函数、指针、字符
《爱烘焙会拍照:速成烘焙大师攻略》内容简介:新浪美食博客首页推荐、百万博主马琳的第四本《马琳的点心书》来啦! 独家配方,操作
《天神和人》内容简介:本书讲述中西方的神话故事,主要是西方的希腊神话中宇宙体系的构建者和中华文明的古老神话中关于宇宙形成的
《盛夏的事》内容简介:本书为华语作家林俊頴的散文集,收入作者为《时报》专栏《三少四壮》所写文章共55篇,包括“蜂巢”“夏天的
Office 2003办公自动化教程-中文版 内容简介 中文版office2003是当前使用得*多的办公自动化套装软件之一,被普遍应用于文字、表格、幻灯片、邮件...
《从平面到立体:设计师必备的折叠技巧》在把诸如织物、纸板、塑料、金属等二维片材制作成三维形态时,许多设计师都会采用折叠这一