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
{BookDescription}CutascenefromtheUSANetworktelevisionseriesMonk,createapromoforS...
《马化腾跑赢互联网的26个竞争策略》内容简介:腾讯17年的风雨兼程,马化腾17年的栉风沐雨,可以说是中国互联网发展的鲜活标本。《
《桂林饮食文化》内容简介:《桂林饮食文化》一书以其深厚的文学和历史学学术功底以及土生土长桂林人的阅历写就了一部至今为止内容
InDesignThinkingPeterRoweprovidesasystematicaccountoftheprocessofdesigninginarch...
《啊哈C!思考快你一步》内容简介:这是一本非常有趣的编程启蒙书,全书从中小学生的角度来讲述,没有生涩的内容,取而代之的是生动
《理念·制度·人》内容简介:20多年超近距离观察华为与任正非,8年研究积淀解析华为快速崛起的底层逻辑。在本书中,华为公司顾问田
管理信息系统 内容简介 本书内容主要包括三大部分, **部分从第1章至第3章, 介绍了企业信息化大环境下管理信息系统产生的背景、相关的概念和相关技术 ; 第二部...
《世界汉学(第10卷)》内容简介:《世界汉学(第10卷)》中国人民大学出版社出版。本书包括了:汉学与汉学家在德国——过时的概念?
《王学研究(第六辑)》内容简介:《王学研究》由贵阳学院阳明学与黔学研究院主办,围绕阳明学研究,征集国内外学者的论文,汇集阳
Anew,revisededitionofayetunrivaledworkonfrequencydomainanalysisLongrecognizedfor...
宽带综合业务数字网是目前国际、国内通信和信息领域的热门话题,是建立信息高速公路的基础。现在的综合业务数字网(ISDN,仅为64
《大数据区块链金融:贵阳的实践与思考》内容简介:《大数据区块链金融》一书从理论支撑、政策支持、学术研究、区块链联盟组织、区
《ASP.NET2.0技术内幕》围绕着ASP.NET2.0是Web开发的重要分水岭这一主题,采用自顶向下的方式介绍ASP.NET2.0的最新编程实践,从更
无线网络需要提供更高的数据速率,而空时处理利用多天线技术和复杂信号处理算法,是改善系统性能的新的强大工具。空时处理技术已
Thisresourcegivesprofessionalsacomprehensiveunderstandingofthesimulationandevalu...
《西方思想的起源》内容简介:《西方思想的起源:古希腊哲学史论》是一本从中国学者自己的思想视野出发对古希腊哲学的正本清源之作
本书是一本机器学习入门教程,包含了数学和统计学的核心技术,用于帮助理解一些常用的机器学习算法。书中展示的算法涵盖了机器学
《邓小平讲话实录:演讲卷》内容简介:《邓小平讲话实录》记述了邓小平从革命战争年代到社会主义建设中发挥的重要作用,他的历次讲
《粘土手办基础教程》内容简介:有没有想过把绘画书中的经典人物形象做成一个栩栩如生的人物模型收藏起来?其实一点也不难!翻开这
《国语》内容简介:本书相传为春秋时期鲁国史官左丘明所作。全书共21卷,分别记载了西周末年至春秋时期(约BC967—BC453)周、鲁、