The webapp package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.




[Skip to ReadMe]


Versions0.0.1, 0.0.2, 0.1.0, 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.6.1
Dependenciesattoparsec, base (>= && <=, base16-bytestring, bcrypt, blaze-builder, bytestring, cryptohash, css-text, data-default, directory, filepath, fsnotify, hashtables, hjsmin, http-types, mime-types, mtl, network, optparse-applicative, scotty, stm, streaming-commons, text, time, transformers, unix, unordered-containers, wai, wai-extra, warp, warp-tls, webapp, zlib [details]
Copyright(c) 2015 Nathaniel Symer
AuthorNathaniel Symer <>
MaintainerNathaniel Symer <>
Home page
Bug tracker
Source repositoryhead: git clone git://
UploadedTue Dec 8 22:35:24 UTC 2015 by natesymer



Maintainers' corner

For package maintainers and hackage trustees

Readme for webapp-0.1.0

webapp - simple webapp scaffolding with state

Basic example:

module Main where

import Web.App
import Web.Scotty.Trans

instance WebAppState Integer where
  initState = return 0
  destroyState st = do
    putStr "Counted: "
    print st

main = webappMain app "My Web App" "This is a demo web app"

app :: (ScottyError e) => ScottyT e (WebAppM Integer) ()
app = do
  get "/add" $ do
    modifyState (+1)
  get "/subtract" $ do
    (State count) <- getState
    putState (State count-1)
  get "/assets/:file" $ param "file" >>= loadAsset

There is also a module called FileCache which is available for loading cached files. It loads files into memory, MD5 sums them, compresses them, and then stores them in the cache.