Spock 0.4.2.3 → 0.4.2.4
raw patch · 2 files changed
+13/−1 lines, 2 filesdep +transformers-base
Dependencies added: transformers-base
Files
- Spock.cabal +2/−1
- Web/Spock/Types.hs +11/−0
Spock.cabal view
@@ -1,5 +1,5 @@ name: Spock-version: 0.4.2.3+version: 0.4.2.4 synopsis: Another Haskell web toolkit based on scotty description: This toolbox provides everything you need to get a quick start into web hacking with haskell: sessions, database helper, authentication and the power of scotty Homepage: https://github.com/agrafix/Spock@@ -35,6 +35,7 @@ time ==1.4.*, monad-control ==0.3.*, transformers ==0.3.*,+ transformers-base ==0.4.*, xsd ==0.4.*, aeson >=0.6, resource-pool ==0.2.*,
Web/Spock/Types.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE TypeFamilies #-} module Web.Spock.Types where import Web.Scotty.Trans@@ -16,6 +17,8 @@ import qualified Data.HashMap.Strict as HM import qualified Data.Text as T import Data.Text.Lazy (Text)+import Control.Monad.Trans.Control+import Control.Monad.Base type SpockError e = ScottyError e @@ -82,6 +85,14 @@ newtype WebStateM conn sess st a = WebStateM { runWebStateM :: ReaderT (WebState conn sess st) (ResourceT IO) a } deriving (Monad, Functor, Applicative, MonadIO, MonadReader (WebState conn sess st))++instance MonadBase IO (WebStateM conn sess st) where+ liftBase = WebStateM . liftBase++instance MonadBaseControl IO (WebStateM conn sess st) where+ newtype StM (WebStateM conn sess st) a = WStM { unWStM :: StM (ReaderT (WebState conn sess st) (ResourceT IO)) a }+ liftBaseWith f = WebStateM . liftBaseWith $ \runInBase -> f $ liftM WStM . runInBase . runWebStateM+ restoreM = WebStateM . restoreM . unWStM type SessionId = T.Text data Session a