welshy: Haskell web framework (because Scotty had trouble yodeling)

[ library, mit, web ] [ Propose Tags ]

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:

Versions [faq] 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
Revised Revision 1 made by MichaelSchroeder at 2015-02-22T21:42:42Z
Category Web
Home page https://github.com/mcschroeder/welshy
Bug tracker https://github.com/mcschroeder/welshy/issues
Source repo head: git clone https://github.com/mcschroeder/welshy.git
Uploaded by MichaelSchroeder at 2013-09-30T18:12:12Z
Distributions NixOS:0.1.0.0
Downloads 997 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees