The scotty package

[Tags: bsd3, library]

A Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp.

{-# LANGUAGE OverloadedStrings #-}

import Web.Scotty

import Data.Monoid (mconcat)

main = scotty 3000 $ do
  get "/:word" $ do
    beam <- param "word"
    html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]

Scotty is the cheap and cheerful way to write RESTful, declarative web applications.

This design has been done in Haskell at least once before (to my knowledge) by the miku framework. My issue with miku is that it uses the Hack2 interface instead of WAI (they are analogous, but the latter seems to have more traction), and that it is written using a custom prelude called Air (which appears to be an attempt to turn Haskell into Ruby syntactically). I wanted something that depends on relatively few other packages, with an API that fits on one page.

As for the name: Sinatra + Warp = Scotty.

WAI
http://hackage.haskell.org/package/wai
Warp
http://hackage.haskell.org/package/warp

[Skip to ReadMe]

Properties

Versions0.0.1, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.10.2 (info)
Change logNone available
Dependenciesaeson (==0.5), base (>=4.3.1 && <5), blaze-builder (==0.3), bytestring (==0.9.1), case-insensitive (==0.4), conduit (==0.1.1.1), data-default (==0.3), http-types (==0.6.8), mtl (==2.0.1), text (==0.11.1), wai (==1.0.0), warp (==1.0.0) [details]
LicenseBSD3
Copyright(c) 2012 Andrew Farmer
AuthorAndrew Farmer <anfarmer@ku.edu>
MaintainerAndrew Farmer <anfarmer@ku.edu>
Stabilityexperimental
CategoryWeb
Home pagehttps://github.com/xich/scotty
Bug trackerhttps://github.com/xich/scotty/issues
Source repositoryhead: git clone git://github.com/xich/scotty.git
UploadedSat Feb 4 23:10:10 UTC 2012 by AndrewFarmer
UpdatedTue Jan 6 19:26:53 UTC 2015 by AndrewFarmer to revision 1
DistributionsFedora:0.9.0, LTSHaskell:0.10.2, NixOS:0.10.2, Stackage:0.10.2
Downloads17055 total (592 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for scotty-0.2.0

Scotty
=====

A Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp.

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

  import Data.Monoid (mconcat)

  main = scotty 3000 $ do
    get "/:word" $ do
      beam <- param "word"
      html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]

Scotty is the cheap and cheerful way to write RESTful, declarative web applications.

  * A page is as simple as defining the verb, url pattern, and Text content.
  * It is template-language agnostic. Anything that returns a Text value will do.
  * Conforms to WAI Application interface.
  * Uses very fast Warp webserver by default.

See examples/basic.hs to see Scotty in action.

    > runghc examples/basic.hs
    Setting phasers to stun... (ctrl-c to quit)
    (visit localhost:3000/somepath)

This design has been done in Haskell at least once before (to my knowledge) by
the miku framework. My issue with miku is that it uses the Hack2 interface
instead of WAI (they are analogous, but the latter seems to have more traction),
and that it is written using a custom prelude called Air (which appears to be an
attempt to turn Haskell into Ruby syntactically). I wanted something that
depends on relatively few other packages, with an API that fits on one page.

As for the name: Sinatra + Warp = Scotty.

Copyright (c) 2012 Andrew Farmer