packages feed

scotty 0.8.1 → 0.8.2

raw patch · 6 files changed

+63/−24 lines, 6 filesdep ~aeson

Dependency ranges changed: aeson

Files

README.md view
@@ -31,8 +31,14 @@  As for the name: Sinatra + Warp = Scotty. +### More Information++Tutorials and related projects can be found in the Scotty wiki:++https://github.com/scotty-web/scotty/wiki+ ### Development & Support  Open an issue on GitHub or join `#scotty` on Freenode. -Copyright (c) 2012-2013 Andrew Farmer+Copyright (c) 2012-2014 Andrew Farmer
Web/Scotty/Action.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, RankNTypes #-}+{-# LANGUAGE CPP, OverloadedStrings, RankNTypes #-} module Web.Scotty.Action     ( addHeader     , body@@ -29,10 +29,14 @@     , runAction     ) where -import Blaze.ByteString.Builder (Builder, fromLazyByteString)+import           Blaze.ByteString.Builder (Builder, fromLazyByteString) -import Control.Monad.Error-import Control.Monad.Reader+#if MIN_VERSION_mtl(2,2,1)+import           Control.Monad.Except+#else+import           Control.Monad.Error+#endif+import           Control.Monad.Reader import qualified Control.Monad.State as MS  import qualified Data.Aeson as A@@ -47,11 +51,11 @@ import qualified Data.Text.Lazy as T import           Data.Text.Lazy.Encoding (encodeUtf8) -import Network.HTTP.Types-import Network.Wai+import           Network.HTTP.Types+import           Network.Wai -import Web.Scotty.Internal.Types-import Web.Scotty.Util+import           Web.Scotty.Internal.Types+import           Web.Scotty.Util  -- Nothing indicates route failed (due to Next) and pattern matching should continue. -- Just indicates a successful response.@@ -59,7 +63,11 @@ runAction h env action = do     (e,r) <- flip MS.runStateT def            $ flip runReaderT env+#if MIN_VERSION_mtl(2,2,1)+           $ runExceptT+#else            $ runErrorT+#endif            $ runAM            $ action `catchError` (defH h)     return $ either (const Nothing) (const $ Just $ mkResponse r) e
Web/Scotty/Internal/Types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, TypeFamilies #-}+{-# LANGUAGE CPP, GeneralizedNewtypeDeriving, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, TypeFamilies #-} module Web.Scotty.Internal.Types where  import           Blaze.ByteString.Builder (Builder)@@ -6,7 +6,11 @@ import           Control.Applicative import qualified Control.Exception as E import           Control.Monad.Base (MonadBase, liftBase, liftBaseDefault)+#if MIN_VERSION_mtl(2,2,1)+import           Control.Monad.Except+#else import           Control.Monad.Error+#endif import           Control.Monad.Reader import           Control.Monad.State import           Control.Monad.Trans.Control (MonadBaseControl, StM, liftBaseWith, restoreM, ComposeSt, defaultLiftBaseWith, defaultRestoreM, MonadTransControl, StT, liftWith, restoreT)@@ -89,8 +93,10 @@     showError Next            = pack "Next"     showError (ActionError e) = showError e +#if !MIN_VERSION_mtl(2,2,1) instance ScottyError e => Error (ActionError e) where     strMsg = stringError+#endif  type ErrorHandler e m = Maybe (e -> ActionT e m ()) @@ -117,7 +123,11 @@ instance Default ScottyResponse where     def = SR status200 [] (ContentBuilder mempty) +#if MIN_VERSION_mtl(2,2,1)+newtype ActionT e m a = ActionT { runAM :: ExceptT (ActionError e) (ReaderT ActionEnv (StateT ScottyResponse m)) a }+#else newtype ActionT e m a = ActionT { runAM :: ErrorT (ActionError e) (ReaderT ActionEnv (StateT ScottyResponse m)) a }+#endif     deriving ( Functor, Applicative, Monad )  instance (MonadIO m, ScottyError e) => MonadIO (ActionT e m) where@@ -139,7 +149,11 @@   instance (ScottyError e) => MonadTransControl (ActionT e) where+#if MIN_VERSION_mtl(2,2,1)+     newtype StT (ActionT e) a = StAction {unStAction :: StT (StateT ScottyResponse) (StT (ReaderT ActionEnv) (StT (ExceptT (ActionError e)) a))}+#else      newtype StT (ActionT e) a = StAction {unStAction :: StT (StateT ScottyResponse) (StT (ReaderT ActionEnv) (StT (ErrorT (ActionError e)) a))}+#endif      liftWith = \f ->         ActionT $  liftWith $ \run  ->                    liftWith $ \run' ->
Web/Scotty/Route.hs view
@@ -1,32 +1,36 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, LambdaCase,+{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, LambdaCase,              OverloadedStrings, RankNTypes, ScopedTypeVariables #-} module Web.Scotty.Route     ( get, post, put, delete, patch, addroute, matchAny, notFound,       capture, regex, function, literal     ) where -import Control.Arrow ((***))-import Control.Concurrent.MVar-import Control.Monad.Error+import           Control.Arrow ((***))+import           Control.Concurrent.MVar+#if MIN_VERSION_mtl(2,2,1)+import           Control.Monad.Except+#else+import           Control.Monad.Error+#endif import qualified Control.Monad.State as MS  import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy.Char8 as BL-import Data.Maybe (fromMaybe)-import Data.Monoid (mconcat)-import Data.String (fromString)+import           Data.Maybe (fromMaybe)+import           Data.Monoid (mconcat)+import           Data.String (fromString) import qualified Data.Text.Lazy as T import qualified Data.Text as TS -import Network.HTTP.Types-import Network.Wai (Request(..))+import           Network.HTTP.Types+import           Network.Wai (Request(..)) import qualified Network.Wai.Parse as Parse hiding (parseRequestBody)  import qualified Text.Regex as Regex -import Web.Scotty.Action-import Web.Scotty.Internal.Types-import Web.Scotty.Util+import           Web.Scotty.Action+import           Web.Scotty.Internal.Types+import           Web.Scotty.Util  -- | get = 'addroute' 'GET' get :: (ScottyError e, MonadIO m) => RoutePattern -> ActionT e m () -> ScottyT e m ()
changelog.md view
@@ -1,6 +1,13 @@+## 0.8.2++* Bump `aeson` upper bound++* Fix `mtl` related deprecation warnings+ ## 0.8.1  * Export internal types+ * Added `MonadBase`, `MonadTransControl` and `MonadBaseControl` instances for   `ActionT` 
scotty.cabal view
@@ -1,5 +1,5 @@ Name:                scotty-Version:             0.8.1+Version:             0.8.2 Synopsis:            Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp Homepage:            https://github.com/scotty-web/scotty Bug-reports:         https://github.com/scotty-web/scotty/issues@@ -68,7 +68,7 @@                        Web.Scotty.Route                        Web.Scotty.Util   default-language:    Haskell2010-  build-depends:       aeson            >= 0.6.2.1  && < 0.8,+  build-depends:       aeson            >= 0.6.2.1  && < 0.9,                        base             >= 4.3.1    && < 5,                        blaze-builder    >= 0.3.3.0  && < 0.4,                        bytestring       >= 0.10.0.2 && < 0.11,