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
《神神鬼鬼》内容简介:《神神鬼鬼》堪称名人谈鬼神的合集,由陈平原选编而成。节录了现当代文学史上如茅盾、周作人、梁实秋、老舍
《正面管教》内容简介:不当的管教方式会影响孩子的一生,而有效的管教方式会有益孩子的一生。本书改变了传统的说教、批评、打骂、
《革命者》内容简介:《革命者》是一部献给革命先烈的正气歌,一部高扬中国共产党人崇高精神,为民族和国家构筑前进灵魂、注入精神
Avisualfeastof400dazzlingimages,thisisacomprehensivesurveyofthegenreoverthelastc...
《Arduino创意机器人入门》内容简介:机器人教育融机械、传感与控制等内容为一体,让学生在手脑并用解决实际问题的过程中,有效地提
《川味人间》内容简介:本书是央视热映大型美食纪录片《川味》顾问曾颖最新力作。作者用54道菜肴,30余幅手绘画,书写舌尖上的人间
《数字信号处理:使用MATLAB》系Brooks/Cole出版公司(ThomsonLearning出版集团的下属子公司)2000年推出的BookWare系列丛书...
约翰•佐雷尔出生于伦敦,在弘赛艺术学院(HornseyCollegeofArt)学习艺术与设计。他十九岁就开始了其设计事业。在他四十余年的设
《物联网渗透测试》内容简介:本书介绍物联网渗透测试的原理和实用技术。主要内容包括IOT威胁建模、固件分析及漏洞利用、嵌入式web
本书从整体出发,全面讲述了软交换的各种技术,包括下一代网络技术概况、软交换的系统框架以及软交换中的媒体风头与信令风头技术
《JavaWeb编程从入门到实践》内容简介:JavaWeb开发是目前最流行的网络开发技术之一。《JavaWeb编程从入门到实践》由浅入深,结合
《工具,还是武器?》内容简介:当下,科技正处于大迸发时代。新技术的开发、大数据的使用、人工智能的探索等,为人类提供了各种各
本书是EJB组件技术教程,专注于EJB的概念、方法、开发过程的介绍。全书共分为4个部分,首先对EJB编程基础进行介绍,其次重点关注
《商业银行操作风险量化分析》内容简介:本书以信度理论和贝叶斯网络为主要工具,研究了操作风险的高级计量法与预警机制,并针对中
政府地理信息系统 本书特色 本书内容丰富,学术性和技术性强。主要读者对象是:政府机关从事政务信息化和电子政务建设的领导同志和技术人员,政府业务部门从事GIS研究...
《基因科技成果利益分享研究》内容简介:基因衍生科技成果,必须对人体组织提供者的利益作出恰当配置,方能保证研发的有序规范进行
《演说思维:阿里演说内训课》内容简介:本书首开先河,凝练IP思维、有我思维、定位思维、链接思维等12大演说思维,融汇心理学、神
《源流说:内容生产与分发的44条法则》内容简介:本书以源流两字概括内容的生产与分发(源指内容生产之源头,流指内容分发之流向)
《众妙之门——网页排版设计制胜秘诀》是SmashingMagazine网站的精选文章合辑,旨在帮助读者提升网页版式设计水平。《众妙之门—
《唐诗三百首》内容简介:唐代是我国古代文学发展的重要阶段,尤其是古代诗歌发展的全盛时期,同时也是一个诗人辈出的时代,因此后