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
JavaScript最新经典教程*Amazon超级畅销书*AJAX程序员必备随着国内的计算机图书市场越来越细化,各类引进版和原创图书在各自领域
《国学经典诵读(套装全6册)》内容简介:◆戴建业教授领衔主编,多位一线名师精心编写。◆228个名言佳句+84首经典诗词+84个国学典
Java Script&Dynamic HTML 语法辞典 内容简介 本书实例主要在windows vista、internet explorer7.0、fir...
《中国建筑艺术史》内容简介:《中国建筑艺术史》是一部中国建筑史简史。《中国建筑艺术史》作者认为,人类建筑思想的进步以及建筑
鲁然斯基等编著的《软件系统架构(使用视点和视角与利益相关者合作原书第2版)》是软件系统架构领域的开创性著作,是两位拥有数十年
《史记八讲》内容简介:本书稿是日本东洋文化研究所访问学者史杰鹏为所开《史记》网课撰写的讲稿的结集。分为“刺客”“游侠”“战
本书是机器学习原理和算法编码实现的基础性读物,内容分为两大主线:单个算法的原理讲解和机器学习理论的发展变迁。算法除包含传
作为一位平面设计师,为什么一定要依赖那些已有的字体、用别人的图形——如果你能够创造自己的标志、字体和书写的话。莱斯利·凯
《信号与系统》采用先时域后变换域的顺序,以对偶和类比的方式逐章逐节、完全并行地讲述连续时间和离散时间信号与系统的一系列基
微型计算机技术及应用:习题、实验题与综合训练题集(第3版) 本书特色 本书特色内容: ·本书是清华大学计算机系列教材和北京市高等教育精品教材立项项目,是在第2版...
《平面设计工艺:材料与印刷的创意解决方案》旨在为设计师和其他从事委托项目设计的专业人员提供视觉效果参考,同时在常见的材料和
《跨海之战》内容简介:金门、海南和一江山三次跨海之战经历了一个相当复杂的过程。以三次战争为线索,体现国共双方在战略方针的较
《自然语言处理简明教程》,本书系统地阐述了自然语言处理的基本方法,描述了每一种方法的技术原理及操作过程。本书可供计算机科
《通信线路维护实用手册》是专门介绍通信线路维护知识的实用技术书籍,书中重点介绍了光电缆基本知识、光电缆接续与测试技术以及
ThemostcompleteguidetoCiscoCatalyst(r)switchnetworkdesign,operation,andconfigura...
《捍卫隐私》内容简介:你的密码可以被轻易破解? 除了你,还有谁在读你的电子邮件? 你的手机就是一个窃听器? 勒索病毒是如何一步
Visual Basic程序设计基础 节选 《高等学校计算机程序设计课程系列教材·Visual Basic程序设计基础》根据教育部高等学校计算机基础课程教学指导...
本书以独特的编辑理念展示了极具视觉冲击力的图像,这些作品既大气而又清晰准确地传达出它们所要表达的信息。本书集实用与艺术于
多源运动图像的跨尺度融合研究/杜军平 内容简介 《多源运动图像的跨尺度融合研究/“十三五”科学技术专著丛书》主要研究了多源运动图像的跨尺度分析、配准、拼接、融合...
TCP/IP详解卷2实现 内容简介 本书完整而详细地介绍了TCP/IP协议是如何实现的。书中给出了约500个图例,15000行实际操作的C代码,采用举例教学的方...