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

Version0.1.0.0
Dependenciesaeson (==0.6.*), base (==4.6.*), 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.*)
LicenseMIT
Copyright(c) 2013 Michael Schröder
AuthorMichael Schröder
Maintainermcschroeder@gmail.com
CategoryWeb
Home pagehttps://github.com/mcschroeder/welshy
Bug trackerhttps://github.com/mcschroeder/welshy/issues
Source repositoryhead: git clone https://github.com/mcschroeder/welshy.git
Upload dateMon Sep 30 18:12:12 UTC 2013
Uploaded byMichaelSchroeder
Downloads79 total (7 in last 30 days)

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees