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
本书比较全面地介绍了网页设计应注意的相关问题,在网页设计基础方面着重讲解了网页框架、页面元素、色彩设计,分析了一些人们容
《职业规划下的高考志愿填报》内容简介:《职业规划下的高考志愿填报》是一本指导考生和家长如何正确填报高考志愿的书,本书分上篇
《我认识的唐朝诗人》内容简介:复旦大学资深教授陈尚君的《我认识的唐朝诗人》,文共30篇,前25篇是写一个诗人或者闻名诗人的人生
《李阳冰篆书三坟记》内容简介:《三坟记》由唐李季卿撰文,李阳冰书,为其篆书代表作。立于唐大历二年(767),碑文阴阳两面,二十
《你的习惯错在哪里》内容简介:思维习惯上的惯性是错误的根源:每个人都有自己思考问题的方式、习惯,思维习惯决定着我们的思想和
《老昆明》内容简介:本书图文并茂,内容丰富,全面展示了民国老昆明的名胜古迹、风土人情、美味珍馐、文化百态、烽火岁月、娱乐休
Inthisinnovativebook,ProfessorRobertHarperoffersafreshperspectiveonthefundamenta...
计算机网络操作技能 内容简介 本书是专为全国高等院校非计算机专业编写的计算机网络实验用书。本书从易教易学的目标出发,采用项目实现+知识延伸+思考与练习的全新教学...
编程的真正挑战不是学习一种语言的语法,而是学习创造性地解决问题,从而构建美妙的应用。《像程序员一样思考》分析了程序员解决
《禅思与诗情(增订本)》内容简介:第一、二章分别介绍达摩禅法和东山法门以及南宗禅后,第三章选取王维、杜甫两个重点人物进行分
计算机免疫系统及其应用 本书特色 本书是作者对人工免疫系统研究的工作总结,主要介绍了人工免疫系统中的否定选择算法、危险理论、免疫克隆算法在网络异常检测、网络安全...
本书针对媒体、通讯、传感等信息技术发展的需要,提出在未来的数字传播中,影像技术与交互设计将成为设计学科中重要的学习内容。
计算机科学概论(刘艺) 本书特色 《计算机科学概论》可作为大学本科"计算机基础"课程教材,也可供自学人员参考使用。为更好地反映*近几年计算机学科的发展现状,作者...
《Revit 2018建筑设计从入门到精通(中文版)》内容简介:本书重点介绍了Autodesk Revit2018中文版的新功能及各种基本操作方法和技
《深入分析JavaWeb技术内幕》围绕JavaWeb相关技术从三方面全面深入地进行阐述。首先介绍前端知识,主要介绍JavaWeb开发中涉及的一
《全国交通运输职业院校课程思政优秀案例集》内容简介:本书收录交通运输职业院校课程思政优秀案例48个,其中课程思政典型案例44个
《WINDOWS游戏编程大师技巧》(第2版)介绍了在Windows环境下进行游戏编程所需用到的各方面知识,作者是著名的游戏开发大师AndrèL
本书紧紧围绕当前大家所关注的3D打印技术,全方位地为读者解读3D打印技术的过去与未来及其行业应用现状,全书分为5个章节,分别介
你会是那个熟读离心力概念却无法解释潮汐成因的中学生吗?其实,中学物理是与日常生活关系最密切的科目。本书将繁杂的物理公式与
本书是目前市面上少见的实战类Bootstrap图书,全书通过5个真实、具体、鲜活,又有代表性的项目实例,讲解了Bootstrap的各种特性和