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
SpringIntegrationisaJava-basedenterpriseintegrationframeworkthatprovidesalightwe...
《开源硬件创客》内容简介:本书共分18章,前3章是本书的基础章节,主要介绍了树莓派的一些基本情况和基本操作,来让读者了解树莓派
作为互联网发展的一个新阶段,Web2.0已经走入了我们的网络生活当中。本书集Web2.0的理念分析与具体设计于一体,希望帮助读者既能
《符号学产品设计方法》基于符号学的视野,结合语言学、传播学、文化学、社会学、心理学等相关概念、原理和分析方法,对产品设计
《幸好有烦恼》内容简介:人为了什么而活着?难道就在吃喝享乐中度此一生吗?相信不少人都有过这种困惑,也在想方设法地寻觅答案。
在网络技术和电子商务飞速发展的今天,Web应用安全面临着前所未有的挑战。所有安全技术人员有必要掌握当今黑客们的武器和思维过程
NicholasC.Zakas是一名前端开发顾问、作者和演讲家。在Yahoo!供职超过5年时间,在这期间他曾是Yahoo!首页首席前端工程师和YUI库
《中华历史一百人(中英对照)》内容简介:《中华历史一百人(中英对照)》是通过讲述人的故事来反映中国历史和文化的一次尝试。因
The#1TelecomGuideforBusinesspeopleandNontechnicalProfessionals—FullyUpdatedforCl...
《我读:陪你读到世界尽头》内容简介:《我读:陪你读到世界尽头》是由梁文道主讲的书评集。用最简洁直白的方式带领读者领略好书的
如何让你的iPad或者iPhone应用在AppStore中出类拔萃?许多书籍单纯从技术方面来探究苹果应用的设计和开发,而本书在探究这些问题
本书系统深入地介绍了各种代码优化编程技术。全书分为4章。第1章集中介绍如何确定程序中消耗CPU时钟最多的热点代码的所谓程序剖析
Thegapbetweenwhodesignersanddevelopersimaginetheirusersare,andwhothoseusersreall...
Sinceitsfoundingin1989byTerrenceSejnowski,NeuralComputationhasbecometheleadingjo...
《化学会呼吸》内容简介:本书基于全国重点中学资深化学老师多年累积的经验和研究成果,以活泼又不失严谨的写作风格,用身边可触摸
本书着重讲解采用波形级仿真技术来评估通信系统性能的原理、方法和实现技术。回顾和总结了相关理论基础,重点讨论实用性的方法,
《Matlab R2016a从入门到精通》内容简介:本书讲述的内容是使用MATLAB进行科学研究、系统仿真、数据分析与处理的必备知识。通过全面
基于R的统计分析与数据挖掘(统计数据分析与应用丛书) 本书特色 薛薇博士编著的这本《基于r的统计分析与数据 挖掘》聚焦当今备受国内外数据分析师和数据应用者 关注...
書裝幀,就如同女媧造人最後吹出的那口氣,賦予一本書新的生命力,更召喚書中內在的靈魂,成為書籍最初的表情,為作品自身說話。
◎中国工业圈“网红”,人民日报、新华社、工业评论、36氪特邀作者,千万级网络红文《闲话工业4.0六重天》作者兔哥主笔◎水月资本