After many months of hard work, the Snap team is proud to announce the release of the next major version of the Snap Framework: Snap 0.3.
New Features
- Snap now has SSL support! To enable SSL support, install the gnutls library and pass the “
gnutls” flag when you buildsnap-server:
$ cabal install snap-server -fgnutlsThe
snapproject starter executable has been pulled out ofsnap-coreand put into its own package, called “snap”. Thesnappackage also contains some library code which the generated projects make use of, and the generated projects have a simplified and much cleaner layout.Snap now comes with support for working in a “development mode” which runs your web handlers in an interpreter using the hint library. This makes working on Snap applications quicker and more convenient, since you no longer need to perform a kill/recompile/reload cycle to see your code changes reflected in your running application.
One of the new things in the
snappackage is an experimental “extensions” mechanism which contains some interfaces/helper code for writing reusable web components.A new
MonadSnaptypeclass has been defined:class (Monad m, MonadIO m, MonadCatchIO m, MonadPlus m, Functor m, Applicative m, Alternative m) => MonadSnap m where liftSnap :: Snap a -> m aMost of the basic functions from
Snap.Typeshave been redefined to accept any monad implementingMonadSnap, andMonadSnapinstances have been defined for most of the standard monad transformers; this should make it much more convenient to use monad transformers with Snap without having to use “lift” all over the place.Added
getCookie :: MonadSnap m => ByteString -> m (Maybe Cookie), which allows you to fetch cookies from the request by name.Snap now depends on the
enumeratorpackage for iteratee support instead ofiteratee.The
snap-servernow has a convenient configuration mechanism which will parse arguments from the command line for you.
Bugfixes/Improvements
Changed type signature of
finishWithfromResponse -> Snap ()toResponse -> Snap a.When using
fileServe, file paths are now properly URL-decoded, meaning you can now download a file with spaces in its name.Parameters grabbed by variable capture using
routeare also now URL-decoded.Under the hood: snap server backend mechanism has been improved/factored out, making it possible to listen to two or more ports using different backends at once (e.g. SSL and non-SSL).