Yesod 1.2 released

May 2, 2013

GravatarBy Greg Weber

The Yesod team is pleased to announce the release of Yesod 1.2. You can get it with:

cabal install yesod-platform yesod-bin

The yesod binary is now a separate package which helps manage dependencies, but it does mean you need to remember to install 2 separate packages.

Yesod 1.1 was released in August. Shortly after, Michael started working for FP Complete. A lot has happened since then!

Yesod ecosystem

Yesod 1.2

Representation system

Previously discussed in the post: a better representation system, cleaner internals, and the request local cache. Providing different representation types (JSON or HTML) used to be cumbersome at times, but now it is simple using selectRep.

getResource :: Handler TypedContent
getResource = do
  selectRep $ do
      provideRep $ [hamlet|<div>|]
      provideRep $ object ["result" .= "ok"]

Request local type-based caching

See the previous mentioned blog post, but you just need to create a newtype wrapper around some data and then you can cache it with the cached function.

Subsite overhaul

Subsites are now just a transformer over a master site

Flexible routing

routing dispatch is more flexible

Better streaming API

streaming has been simplified

Asset pipeline

Yesod has always made it easy to combine dynamic css and javascript since before Rails started using the term asset pipeline. What was missing was the same ease for static assets. Combining static assets is very important for optimal performance by reducing the total number of network requests. You can now easily combine CSS and Javascript with the combineScripts and combineStylesheets helpers. Here is the scaffolding change and you can also look at the haddock documentation.

Better testing

yesod-test was completely overhauled, making it easier to use and providing cleaner integration with hspec.. It is easy in Haskell to just lean against the type system for most things and skip testing, particularly if it is something that is hard to test with QuickCheck. But yesod-test (and wai-test) are there to prevent bugs that the type system cannot.

Even more

  • More efficient session handling.
  • yesod-auth email plugin now supports logging in via username in addition to email address.
  • probably more stuff we forgot to mention

Conclusion & more info

FPComplete's development of the School of Haskell has been great for the Haskell community to keep spreading knowledge. It has also been running with the changes for 1.2 for quite a while which should contribute to making 1.2 a more stable release.

The high-level changelog has been discussed in high-level here. Detailed changes are here

The book documentation for 1.2 has been started, but still needs more work to get fully up to date.

Most of the changes to upgrade your site to 1.2 should be fairly mechanical. I started a wiki page for the upgrade. If you have any issues, please note them there or on the mail list.

We hope you enjoy using Yesod 1.2

Comments

comments powered by Disqus

Archives