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
《Kali Linux 高级渗透测试(原书第3版)》内容简介:Kali Linux面向专业的渗透测试和安全审计,集成了大量精心挑选的安全检测工具
《商业银行资产负债管理实践》内容简介:本书是在学习借鉴国际先进商业银行资产负债管理理论和实践的基础上,对中国商业银行多年资
{内容简介}在你成为一名行家之后,阅读HTML书籍给你的唯一感受就是厌烦吗?那么现在就是你拿起《深入浅出HTML与CSS、XHTML》来真
GPRS技术继承和发展了GSM体系结构,并为第三代移动通信技术的发展提供了基础。《通用分组无线业务(GPRS)技术与应用》结合GSM相关
HowtoBreakSoftwareisadeparturefromconventionaltestinginwhichtestersprepareawritt...
Recentdecadeshaveseenadramaticshiftawayfromsocialformsofgamblingplayedaroundroul...
全国计算机等级考试最新真考题库模拟考场及详解·二级MSOffice高级应用 内容简介 本书是针对2019年全国计算机等级二级考试编写的辅导用书。本书严格按照新版...
《如何管理设计流程:设计思维》介绍了设计师创意概念产生的过程,目标是完成一整套创意过程的线索。强调想法和方法在设计问题解决
改变未来的九大算法 本书特色 google得出的搜索结果是如何产生的? 百度为何会陷入“搜索门”,又是什么机制使然?身处在大数据时代...
内容简介活用CSS讓Web設計更多元!本書因應Web設計而生,在書中我們將焦點放在最重要的兩種語言上,即XHTML與CSS,並融合了目前最
《武将的一天》内容简介:本书通过展示古代武将(楚庄王熊吕、周瑜、完颜宗翰、拜答尔、王坚、戚继光)的一天,来表现不同历史时期
《SoftwareDesign中文版03》的主题为:sed/AWK入门和Mac开发环境。特辑1详细讲解了sed与AWK的基础与使用方法、日志分析、ShellSc
《百年求索:演进与跃迁》内容简介:书稿内容来自2019年春节在北京中法大学旧址举办的中华优秀传统文化进入山东地方必修课程研讨对
中文版Dreamweaver+Flash+Photoshop网页制作从入门到精通-CS5版-随书附赠光盘 本书特色 16大核心技术精解本书体系结构完整,由浅入深...
在线阅读本书Web2.0architectureopensupanincrediblenumberofoptionsforflexiblewebdesign,c...
《Photoshop电商设计与装修从新手到高手》内容简介:本书是一本系统讲解Photoshop电商设计与装修的教程。主要讲述了Photoshop电商设
《历史名镇:孟河镇》内容简介:孟河镇位于江苏省常州市西北,是一个依山傍水、风景秀丽、四季分明的宜农耕、宜居住的理想地区。孟
用Python编写程序,是相当容易的,所以这门语言非常流行。但若想掌握Python所特有的优势、魅力和表达能力,则相当困难,而且语言
《超越CSS:Web设计艺术精髓(修订版)》系统、深入地阐释了网站的设计与实现,帮助读者从设计的角度来使用CSS以达到完美的效果。作
《互联网商业的下半场》内容简介:随着人工智能和IT技术的发展,以科技为圆心、以资本为半径的互联网商业的上半场已离我们远去,以