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
Photoshop实训教程 内容简介 Adobe Photoshop是当前*流行的专业图像处理软件, 其强大的功能为设计师提供了广阔的创意空间和无限的表现手法。...
《JAVA核心技术卷2:高级特征》是Java技术权威指南,全面覆盖Java技术的高级主题,包括流与文件、XML、网络、数据库编程、高级Swi
《中国新三板年度报告(2017年)》内容简介:新三板自2013年12月14日推向全国以来,至今已经历完整四年。这四年,在交易和融资活跃
《军事政治学研究(2015年第2辑/总第10辑)》内容简介:《军事政治学研究》是由中国人民解放军南京政治学院军事政治学研究中心创办
计算机网络安全教程-(修订本) 本书特色 《计算机网络安全教程》(修订本)在原书基础上做了大量修整和扩充,使之更加适合高校教学和自学的需要。利用大量的实例讲解知...
《图灵的大教堂》内容简介:1936年,时年24岁的图灵宣称:“发明一台可用于计算任意可计算序列的单一机器是有可能的。”在《图灵的
《支付方法论》内容简介:这是一部从产品、运营、业务、技术4个维度全面讲解支付理论与实操的著作。详细阐述了如何通过支付系统建设
Godinslatestbusinesshandbook(afterSmallIstheNewBigandTheDip)revisitssomeofhismos...
《三维CAD/CAM》内容简介:结合机械类专业的实际,以够用为度,主要讲述设计模块和加工模块。第一部分为设计模块(即CAD模块),主
《互联网:碎片化生存》内容简介:在世界互联网人数超过17亿,中国网民接近4亿的时候,断言“这个版本的互联网没有未来”是要冒很
《手绘设计草图表现技法》内容简介:本书阐述了手绘图透视表现的基本原理、制图方法和物体的质感表现等,介绍了多种手绘图表现的画
《清华少年说(第四辑)》内容简介:这是一本关于清华年青学子的书籍。无论是醉心学术、勤奋有加的学霸,还是矢志不渝、情系家国的
《15分钟!铅笔素描练习册(风景篇)》内容简介:对于素描初学者来说,素描入门最难跨过的那道坎就是在有了满肚子理论基础和一大堆
《瞻奥集:中古中国共同研究班十周年纪念论丛》内容简介:本稿为复旦中古研究班十年纪念论文集。基于共通的治学理念与研究领域,20
《艺术设计概论》在中国,“设计”(DESIGN)这个词,从一个专业涧汇变成一个社会上非常流行和时尚的语词,也就是时间进入21世纪之
《金融的逻辑(套装共2册)》内容简介:《金融的逻辑》(上、下)是陈志武教授关于金融的发展历史、演变、影响和作用的一部作品,由
《沈从文的后半生:1948—1988(增订版)》内容简介:这是一部“感动沈从文家人”的沈从文传记,一部令《活着》作者“感慨万分”的
深度学习-基于MATLAB的设计实例 本书特色 深度学习如此流行,以至于关于它的资料随处可见。但往往是理论连篇,并不适合开发者具体使用,本书内容丰富实用、原理直...
《多人在线游戏架构实战:基于C++的分布式游戏编程》内容简介:本书主要讲述大型多人在线游戏开发的框架与编程实践,以实际例子来介
《出众的设计师:全栈设计师高效成长法则》内容简介:我们处在一个快速发展的时代,各行各业都被不断突破并重组,很多岗位被重新定