packages feed

welshy-0.1.0.0: welshy.cabal

name:                welshy
version:             0.1.0.0
synopsis:            Haskell web framework (because Scotty had trouble yodeling)
description:
  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:
  .
  * You can 'halt' the current action at any point and continue
    with a different one.
  .
  * Functions like 'queryParam' and 'jsonParam' have built-in error handling.
  .
  * Welshy's 'Action' monad is an instance of 'Alternative'.



license:             MIT
license-file:        LICENSE
author:              Michael Schröder
maintainer:          mcschroeder@gmail.com
homepage:            https://github.com/mcschroeder/welshy
bug-reports:         https://github.com/mcschroeder/welshy/issues
copyright:           (c) 2013 Michael Schröder
category:            Web
build-type:          Simple
cabal-version:       >=1.8

extra-source-files:
  example.hs

library
  exposed-modules:  Web.Welshy
  other-modules:    Web.Welshy.Action,
                    Web.Welshy.FromText,
                    Web.Welshy.Request,
                    Web.Welshy.Response
  build-depends:
      base ==4.6.*
    , aeson ==0.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.*  
  
  extensions:
    GeneralizedNewtypeDeriving
    -- LambdaCase
    OverloadedStrings
    RecordWildCards

source-repository head
  type:     git
  location: https://github.com/mcschroeder/welshy.git