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
ACalltoActionthatAnswerstheQuestionsPosedbytheGrammyAward-WinningAnInconvenientT...
《中国:推动金砖国家合作第二个黄金十年》内容简介:“求和平、谋发展、促合作、图共赢”,金砖国家“十年磨一剑”,一步一个脚印
登月是一场骗局?南北半球浴室里水流的漩涡真的不同吗?只有在春分那一天才能竖起鸡蛋?真的有人看到过UFO或外星人吗?陨星会落在
学者型的弗洛伊德情场上风采依然,缠绵的爱恋、炽热的情感、渊博的学识向人们展示了欧洲最优秀知识分子的生活与精神状态。本书所
InthetraditionofWhoOwnstheFuture?andTheSecondMachineAge,anMITMediaLabscientistim...
《做一个清醒的现代人》内容简介:在当代中国传统文化的纵向传承与外来文化的横向互动中,在这种“纵横交错”的文化背景下,刘擎教
《酷科技》是一本有趣的书,有点像一本“武林秘笈”,在书中,你会探索在宇宙和外空间的飞行器是如何工作的,原理是怎么样的?建
软件功能测试基于Quick Test Professional应用 本书特色 《软件功能测试--基于QuickTest Professional应用》由李晓鹏、...
“工艺美术运动”、“新艺术运动”和“装饰艺术运动”是人类设计和美术运动史上非常独特的相互交错的伟大实践,也是改变了今天我
《智慧党建》内容简介:本书首先阐述了党委信息化,指出领导干部要强化信息化思维、提高数字领导力,分析了数字党建的内涵、意义和
当技术使整个社会突变到移动互联时代,实现了社群、人人实时在线等质变,企业应该如何在移动互联时代实现生存、进化?。《社群经
《布光是门大学问》内容简介:摄影离不开光,有光才有影。摄影就是用光来作画的,如何利用光与影的关系来构成影像和影调,是摄影创
《Oracle性能诊断艺术》以优化Oracle应用程序为目的,先介绍Oracle性能优化的基本原理、关键概念,从业务角度和系统角度分析性能
《人工智能》从一个新颖的角度对人工智能各方面的问题进行了探讨。由浅入深地介绍了整个人工智能系统和agent的发展历程。首先,描
本教材以力学理论和控制理论的全面讲述为特色。教材的重点在于用严谨而系统的方式介绍机器人动力学与控制的基本概念和主要结果。
这本书以街道的视觉秩序的创造作为建筑平面布局形成设计的出发点,分别从街道的自然特征,美学规律,人文特色出发由浅至深论述如
《卡塔尔经贸文化》内容简介:本书采取厚今薄古的写作方式,全方位介绍卡塔尔的国情、经贸、文化、中阿交流及其习俗礼仪等,突出科
《一个女孩的恐惧》内容简介:一个深夜,女孩手持双管猎枪,径直冲进森林,用枪口抵住一个人的额头,扣下扳机 人们常常说熊镇太不起
《当代科技艺术》是关于科技艺术的理论、创作以及科普教育艺术化等研究成果的综合,对科技艺术的理论体系进行了创新性的设计和凝
《无互动,不营销》内容简介:《无互动,不营销》旨在探究回答:互动营销在整体数字战略中发挥何种功能?互动营销所追求的与消费者