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
《家庭按摩取穴定位速查一本就够》内容简介:经络和穴位的神奇之处在于,它们遍布全身,每条经络、每个穴位都有独特的养生功效,我
《QQ营销》内容简介:本书对互联网营销中普遍采用的矩阵式营销加以归纳和总结,给出了矩阵式营销的概念和一般方法,并使用矩阵式营
《“文学”概念史》内容简介:“文学”是什么?自19世纪初近代意义的“文学”在西方兴起,中外学术界就不断有学者对这些问题给出自
PEAR,thePHPExtensionandApplicationRepository,isabountifulresourceforanyPHPdevelo...
《中国历史人物(英文版)》内容简介:了解一个国家,必先了解此国的人。在本书中,你将一览中国历史长河,认识曾在哲学、艺术、文
《心理画:摆脱精神内耗的涂鸦心理学》内容简介:在生命的某个时刻,你是否怀疑过自己值不值得被爱?是否在取悦别人的过程中压抑或
本书内容完全站在网页制作技术的角度上,从网页必备元素开始,详细而完整地讲解了相关标记,并且用大量范例说明各元素的使用方法
《CSS实战精粹》囊括了CSS工作原理的所有细节,主要介绍了能够在项目中使用的具体CSS设计技巧,包括CSS布局、创建一般页面元素以
《仰顾山房文稿》内容简介:本书是凤凰枝文丛之一种,作者俞国林是中华书局编辑,先后策划《顾颉刚全集》等具有影响力的图书多种,
《数字信号处理:使用MATLAB》系Brooks/Cole出版公司(ThomsonLearning出版集团的下属子公司)2000年推出的BookWare系列丛书...
《住宅精细化设计》为作者针对住宅设计要点的长期研究的总结。书中就住宅精细化设计过程中的方法、意义和建议等问题,围绕我国住
人工智能-计算Agent基础 本书特色 普尔、麦克沃思所著的《人工智能(计算agent基础)/计算机科学丛书》非常全面地介绍了人工智能科学,涵盖智能体、表达和推...
《MATLAB神经网络编程》结合神经网络的概念、理论和应用,以MATLAB为平台,系统地介绍了神经网络工具箱中的前向型神经网络、局部
运用最新策略揭示当今最具破坏力的攻击《灰帽黑客:正义黑客的道德规范、渗透测试、攻击方法和漏洞分析技术(第3版)》在上一版的基
《Hadoop 2.X HDFS源码剖析》内容简介:《Hadoop 2.X HDFS源码剖析》以Hadoop 2.6.0源码为基础,深入剖析了HDFS 2.X中...
《PaaS实现与运维管理》内容简介:《PaaS实现与运维管理:基于Mesos +Docker+ELK的实战指南》主要阐述了云计算中PaaS平台的实现与运
《新农人看农村》内容简介:随着“大众创业、万众创新”时代的到来,越来越多的大学生村官凭借多年所学和灵活的创新意识、丰富的互
《深入浅出HTML5编程(影印版)(英文)》就是你的特快车票,它可以带你学习如何使用今天的标准同时也会是明日的最佳实践来搭建Web应
SPSS数据分析-问题提出与实例导学 本书特色 《SPSS数据分析:问题提出与实例导学》由中国水利水电出版社出版。SPSS数据分析-问题提出与实例导学 目录 前...
《知堂乙酉》内容简介:《知堂乙酉文编》收入周作人文章十八篇(包括题记),多作于四十年代末。其中有知堂一向喜谈的历史、风俗、