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
本书由“java之父”JameGosling以及另外三位顶级大师撰写而成,无论是对java语言的初学者还是专业程序员都具有极高的价值,是关于
《idea+提升创意力的设计诀窍书》内容简介:没有设计素材怎么办?如何在经费捉襟见肘的情况下做出好设计?怎样运用不同的设计软件
精通D3.js-交互式数据可视化高级编程 本书特色 本书以当前流行的数据可视化技术d3.js为主要内容,分为三大部分,共计13章。**部分讲述基础知识,第二部分...
本书详细地讨论了如何编写健壮高效的代码以及模块设计技术。本书采用了自问自答的语言风格,它讨论了实际程序设计中普遍存在的,
本书首先解释了AJAX为什么在大规模的开发中能有如此广阔的应用前景,接着系统地介绍了当前重要的AJAX技术和组件。你将看到把数据
《当我们变成一堆数字》讲述了:每一天,我们的身后都拖着一条由个人信息组成的长长的“尾巴”,这只是因为我们生活在一个现代化
《合伙人:股权分配、激励、融资、转让(第2版)》内容简介:本书由全网粉丝超过500万的HR商学院院长、首席人事官胡华成老师,根据
Photoshop建筑表现图专业技法与范例-附光盘 本书特色 《Photoshop建筑表现图专业技法与范例》:超值多媒体光盘12段多媒体全程配音教学视频30个建...
《迟到民族与激进思想》内容简介:在《迟到民族与激进思想》中,作者以《德国思想的他者视角》开篇,从著名学者卡尔·曼海姆、马丁
《丝路朝圣》内容简介:本系列文章以《大唐西域记》为切入点,因为这是中印文化交流中最重要的一部典籍,当年以季羡林先生为主组织
《野地灵光:我住精神病院的日子》内容简介:身患重度抑郁症十余年的作家李兰妮,终于下决心住进了精神病院。本书记录了作者住院治
《就是爱吃肉》内容简介:但愿木可著的这本《就是爱吃肉(在家做饭很简单)》能为你开启一个全新的厨艺天地,哪怕你没有太多下厨时
系统与数据恢复技术 本书特色 本教材主要针对目前主流操作系统Windows及其文件系统下的数据恢复方法、技术和编程实现,重点介绍Windows系统环境下的系统和...
《中国与世界经济》内容简介:2015年世界经济的整体形势基本延续了2010年以来缓慢复苏的势头,但是增长状况已低于预期。同时,世界
《松子落》内容简介:一个人有一个人的京都。九年时光,青翠转浓荫,是漫长光阴凝缩作一粒琥珀,是长镜头流转中的迅疾一瞬。苏枕书
《张洁文集·散文随笔卷》内容简介:《散文随笔卷》在阅读过程中不仅能品味这些佳作的散文随笔卷思想性、艺术性,而且还能从中明白
《职场进阶的60个原则》内容简介:以原则为基础的人生成为专家型人才,还是管理型人才?接受犯错让下属干,还是撸起袖子亲自干?从
中文版Windows7 从入门到精通 本书特色 《从入门到精通系列:中文版windows 7从入门到精通》特点一本图书 三本价值1本书=入门十提高十精通=3本书...
《普通高等教育"十一五"规划教材•神经网络实用教程》基于MATLAB6.5/7提供的神经网络工具箱,介绍了神经网络常用算法、优化算法及
《温故(之六)》内容简介:《温故》是一种陆续出版的历史文化读物。以今天的视角来追怀与审视过去,并为当下的生存与未来的发展提