Another Haskell web framework for rapid development


Version on this page:
LTS Haskell 12.26:
Stackage Nightly 2018-03-12:
Latest on Hackage:

See all snapshots Spock appears in

BSD-3-Clause licensed and maintained by Alexander Thiemann
This version can be pinned in stack with:Spock-,3898


Build Status Hackage


Hackage: Spock Stackage: Spock

Another Haskell web framework for rapid development

Library Usage Example

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

import qualified Data.Text as T

main =
    runSpock 3000 $ spockT id $
    do get ("echo" <//> var) $ \something ->
        text $ T.concat ["Echo: ", something]


  • Using cabal: cabal install Spock
  • Using Stack: stack install Spock
  • From Source (cabal): git clone https://github.com/agrafix/Spock.git && cd Spock && cabal install
  • From Source (stack): git clone https://github.com/agrafix/Spock.git && cd Spock && stack build

Mailing list

Please join our mailing list at haskell-spock@googlegroups.com


Another Haskell web framework for rapid development: This toolbox provides everything you need to get a quick start into web hacking with haskell:

  • fast typesafe routing
  • middleware
  • json
  • sessions
  • cookies
  • database helper
  • csrf-protection
  • typesafe contexts

Important Links




The following Spock extensions exist:

Works well with Spock


If you’d like to use your application via HTTPS, there are two options:

  • Use nginx/haproxy/… as reverse proxy in front of the Spock application.
  • Convert the Spock application to a wai-application using the spockAsApp. Then use the warp-tls package to run it.


See the Spock-bench repository to reproduce.

Framework GHC Version simple route route with one param deeply nested route
Spock 7.10.2 69243 65835 64763
scotty 7.10.2 0.10.2 66441 65357 9542
snap 7.10.2 39964 35566 38356
fn 7.10.2 63083 63183 22346
servant 7.10.2 0.7 66041 65590 64606

Example Projects


Since version Spock drops simple routing in favor of typesafe routing and drops safe actions in favor of the “usual” way of csrf protection with a token.

Since version Spock supports typesafe routing. If you wish to continue using the untyped version of Spock you can Use Web.Spock.Simple. The implementation of the routing is implemented in a separate haskell package called reroute.

Since version Spock is no longer built on top of scotty. The design and interface is still influenced by scotty, but the internal implementation differs from scotty’s.

Thanks to

  • Tim Baumann Github (lot’s of help with typesafe routing)
  • Tom Nielsen Github (much feedback and small improvements)
  • … and all other awesome contributors!


Pull requests are welcome! Please consider creating an issue beforehand, so we can discuss what you would like to do. Code should be written in a consistent style throughout the project. Avoid whitespace that is sensible to conflicts. (E.g. alignment of = signs in functions definitions) Note that by sending a pull request you agree that your contribution can be released under the BSD3 License as part of the Spock package or related packages.


Supported GHC Versions

  • 7.8.4
  • 7.10.2
  • 8.0


Released under the BSD3 license. (c) 2013 - 2016 Alexander Thiemann