Yesod Web Framework

A solid foundation for web applications

Overview

Yesod is a Haskell web framework promoting type-safe, RESTful web application development. It is built from the ground up on principles which allow the creation of efficient execution. Its modular nature lets you pick and choose which parts of the framework you wish to use, while its default collection of libraries allows you to write in a consistent, concise manner.

Hello World

import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [$parseRoutes|/ Home GET|]
instance Yesod HelloWorld where approot _ = ""
getHome = applyLayout [$hamlet|%h1 Hello World|]
main = basicHandler 3000 HelloWorld

Model

  • Built on persistent.
  • Supports both SQL and non-SQL databases.
  • Every field is fully typed.
  • Searching, sorting, updating, inserting all type checked.
  • All marshalling and SQL code auto-generated.

View

  • Built on Hamlet.
  • Haml-like syntax.
  • Automatic, intelligent HTML entity escaping based on types.
  • Built-in support for type-safe URLs.
  • Compile-time checked.

Controller

  • Built on web-routes-quasi.
  • Every application has its own URL datatype.
  • You cannot create an invalid internal link.
  • All parse and render code automatically generated.

RESTful

  • Separate handlers for each request method.
  • Different representations for each content type.
  • Content type determined automatically from request headers.

Modular

  • Composed of many smaller packages.
  • Has spawned the creation of many packages available for use outside of Yesod.

Screencasts

  • Hello World (8:50) A good overview, explaining some of the fundamentals of Yesod.
  • Blog, part 1 (14:23) A first look at persistent and a glance at widgets.
  • Blog, part 2 (9:35) Automated forms with the Crud subsite.

Full-featured

  • Provides all the basics of a web framework: model, view and controller
  • Has additional features not commonly found: client-side sessions, third-party authentication, JSON-P support
  • Very fast development pace, adding new features weekly

Powered by Yesod

  • Search-Once: Create alerts to be updated of changes in search results.
  • hledger: hledger is a computer program for easily tracking money, time, or other commodities, using standard accounting principle.
  • Urban Listings: A free listing website for the South African property market.
  • Luach: English and Hebrew anniversary reminders.
  • Bloggy: A simplistic blog engine.
  • Photoblog: Basic photo blog using Amazon S3 for file hosting.