Spock

Another Haskell web framework for rapid development

http://www.spock.li

Version on this page:0.10.0.1@rev:1
LTS Haskell 21.25:0.14.0.0
Stackage Nightly 2023-06-21:0.14.0.0
Latest on Hackage:0.14.0.0

See all snapshots Spock appears in

BSD-3-Clause licensed and maintained by Alexander Thiemann
This version can be pinned in stack with:Spock-0.10.0.1@sha256:4c9fc2e3aae3df4e64c014a0fcba192dda7e1bd244c87145e0723bf0c6b2abf4,4527

Spock

Build Status Hackage

Intro

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]

For more examples check the examples/ directory.

Install

  • 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

Features

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

  • fast routing (both typesafe and “untyped”)
  • middleware
  • json
  • sessions
  • cookies
  • database helper
  • csrf-protection
  • typesafe contexts

Important Links

Talks

Candy

Extensions

The following Spock extensions exist:

Works well with Spock

Benchmarks

Please note that these benchmarks might not be up to date anymore.

Example Projects

Notes

Since version 0.7.0.0 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 0.5.0.0 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!

Hacking

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.

Misc

Supported GHC Versions

  • 7.6.3
  • 7.8.4
  • 7.10.2

License

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