The welshy package

[Tags:library, mit]

A Haskell web framework heavily influenced by the excellent Scotty, which was in turn influenced by Ruby's Sinatra.

Welshy strives to make it easier to do error handling without overly complicating the control flow. An example:

{-# LANGUAGE OverloadedStrings #-}
 import Control.Applicative
 import Control.Monad
 import qualified Data.Text.Lazy as T
 import Network.HTTP.Types
 import Web.Welshy

 fibs :: [Int]
 fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

 main :: IO ()
 main = welshy 3000 $ do
     get "/fibs" $ do
         offset <- queryParam "offset" <|> return 0
         length <- queryParam "length"

         when (offset < 0 || length < 0)
              (halt $ status badRequest400)

         when (offset + length > 1000)
              (halt $ status requestedRangeNotSatisfiable416)

         let result = take length $ drop offset fibs
         text $ T.pack $ show result

Some of the features demonstrated here:

Properties

Versions 0.1.0.0
Dependencies aeson (==0.6.*), base (>=4.6 && <4.8), blaze-builder (==0.3.*), bytestring (==0.10.*), conduit (==1.0.*), http-types (==0.8.*), lifted-base (==0.2.*), resourcet (==0.4.*), text (==0.11.*), transformers (==0.3.*), unordered-containers (==0.2.*), wai (==1.4.*), warp (==1.3.*) [details]
License MIT
Copyright (c) 2013 Michael Schröder
Author Michael Schröder
Maintainer mcschroeder@gmail.com
Stability Unknown
Category Web
Home page https://github.com/mcschroeder/welshy
Bug tracker https://github.com/mcschroeder/welshy/issues
Source repository head: git clone https://github.com/mcschroeder/welshy.git
Uploaded Mon Sep 30 18:12:12 UTC 2013 by MichaelSchroeder
Updated Sun Feb 22 21:42:42 UTC 2015 by MichaelSchroeder to revision 1
Distributions
Downloads 272 total (4 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees