Universal and robust reloading for Haskell web applications
Haskell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
driver Update cabal file Apr 20, 2015
src Update cabal file Apr 20, 2015
test Depend on mockery Apr 22, 2015
.ghci Properly handle large response bodies (close #2) Aug 18, 2014
.gitignore Initial commit Mar 30, 2014
.travis.yml Update cabal file Apr 20, 2015
LICENSE Add cabal file Apr 28, 2014
README.lhs Update README Aug 11, 2014
README.md Update README May 31, 2017
Setup.lhs Initial commit Mar 30, 2014
package.yaml Depend on mockery Apr 22, 2015
reserve.cabal Depend on mockery Apr 22, 2015

README.md

reserve

DISCLAIMER: This is early stage software. It is already functional and useful, but it still has some rough edges.

reserve provides code reloading for Haskell web applications. You can run you application with reserve during development and code changes will take immediate effect.

Requirements

reserve can reload arbitrary Haskell web applications. The only requirement is that your application works with ghci.

Examples

Scotty

Create a file app.hs with the following content:

{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty

main :: IO ()
main = scotty 3000 $ do
  get "/" $ do
    text "hello\n"
$ reserve app.hs

Make a request to http://localhost:12000, modify app.hs, reload!

Snap (sandboxed)

$ mkdir my-project && cd my-project
$ cabal sandbox init
$ cabal install snap
$ cabal exec snap init barebones
$ cabal exec -- reserve -p 8000

Make a request to http://localhost:12000, modify src/Main.hs, reload!

Customization

By default reserve assumes that the Main module of your application is at src/Main.hs. You can customize this by passing the path to your Main module to reserve:

$ reserve src/app.hs

By default reserve assumes that your application listens on port 3000. You can customize this by passing --port to reserve:

$ reserve --port 8000

By default reserve serves your application on port 12000. You can customize this by passing --reserve-port to reserve:

$ reserve --reserve-port 4040

You can pass command-line arguments to your application by separating them with --:

$ reserve src/app.hs -- --mode development

reserve uses ghci to run your application. If your application requires any addition GHC options, you can put them into ./.ghci:

$ echo ":set -isrc" >> .ghci
$ reserve src/app.hs

reserve works with Cabal sandboxes, just run it with cabal exec -- reserve.