packages feed

simple 0.11.3 → 2.0.0

raw patch · 7 files changed

Files

simple.cabal view
@@ -1,5 +1,5 @@ name:                simple-version:             0.11.3+version:             2.0.0 synopsis: A minimalist web framework for the WAI server interface description: @@ -52,10 +52,12 @@     , filepath     , process     , setenv-    , simple-templates >= 0.7.0+    , simple-templates >= 2.0.0     , text     , unordered-containers     , vector+  other-modules:+    Paths_simple  library   hs-source-dirs: src@@ -122,6 +124,9 @@     , transformers-base     , unordered-containers     , vector+  other-modules:+    Web.Simple.Controller.Trans,+    Web.Simple.Responses  source-repository head   type: git
src/Web/Frank.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} {- | Frank is a Sinatra-inspired DSL (see <http://www.sinatrarb.com>) for creating routes. It is composable with all 'ToApplication' types, but is designed to be used
src/Web/REST.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy, FlexibleInstances, OverloadedStrings #-}+{-# LANGUAGE Safe, FlexibleInstances, OverloadedStrings #-} {- |  REST is a DSL for creating routes using RESTful HTTP verbs.
src/Web/Simple/Controller.hs view
@@ -52,7 +52,6 @@ import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Char8 as L8-import           Data.Monoid import           Data.Text (Text) import           Network.HTTP.Types import           Network.Wai@@ -213,7 +212,7 @@ -- | Reads and returns the body of the HTTP request. body :: Controller s L8.ByteString body = do-  bodyProducer <- requestBody `fmap` request+  bodyProducer <- getRequestBodyChunk `fmap` request   liftIO $ do     result <- consume mempty bodyProducer     return $ toLazyByteString result
src/Web/Simple/Controller/Trans.hs view
@@ -60,11 +60,11 @@                               Right result -> (Right $ f result, st)  instance (Monad m, Functor m) => Applicative (ControllerT s m) where-  pure = return+  pure a = ControllerT $ \st _ -> return $ (Right a, st)   (<*>) = ap  instance Monad m => Monad (ControllerT s m) where-  return a = ControllerT $ \st _ -> return $ (Right a, st)+  return = pure   (ControllerT act) >>= fn = ControllerT $ \st0 req -> do     (eres, st) <- act st0 req     case eres of@@ -94,6 +94,9 @@  instance MonadIO m => MonadIO (ControllerT s m) where   liftIO = lift . liftIO++instance Monad m => MonadFail (ControllerT s m) where+  fail = err  instance (Applicative m, Monad m, MonadBase m m) => MonadBase m (ControllerT s m) where   liftBase = liftBaseDefault
src/Web/Simple/Templates.hs view
@@ -10,6 +10,7 @@  import Control.Monad.IO.Class import Data.Aeson+import qualified Data.Aeson.KeyMap as K import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L import qualified Data.HashMap.Strict as H@@ -135,14 +136,14 @@  valueLength :: Value -> Value valueLength (Array arr) = toJSON $ V.length arr-valueLength (Object obj) = toJSON $ H.size obj+valueLength (Object obj) = toJSON $ K.size obj valueLength (String str) = toJSON $ T.length str valueLength Null = toJSON (0 :: Int) valueLength _ = error "length only valid for arrays, objects and strings"  valueNull :: Value -> Value valueNull (Array arr) = toJSON $ V.null arr-valueNull (Object obj) = toJSON $ H.null obj+valueNull (Object obj) = toJSON $ K.null obj valueNull (String str) = toJSON $ T.null str valueNull Null = toJSON True valueNull _ = error "null only valid for arrays, objects and strings"
src/smpl.hs view
@@ -4,13 +4,11 @@ module Main (main) where  import Prelude hiding (writeFile, FilePath, all)-import Control.Applicative import Control.Monad (when) import Data.Aeson import Data.Char import qualified Data.ByteString.Char8 as S8 import qualified Data.Text.Encoding as T-import Data.Monoid (mempty) import Data.Version import System.Console.CmdArgs import System.Directory