Spock-core 0.13.0.0 → 0.14.0.0
raw patch · 2 files changed
+17/−23 lines, 2 filesdep +mmorphdep −directorydep ~resourcetdep ~waiPVP ok
version bump matches the API change (PVP)
Dependencies added: mmorph
Dependencies removed: directory
Dependency ranges changed: resourcet, wai
API changes (from Hackage documentation)
- Web.Spock.Core: (<//>) :: Path as 'Open -> Path bs ps -> Path (Append as bs) ps
+ Web.Spock.Core: (<//>) :: Path as 'Open -> Path bs ps -> Path (Append as bs) ps
- Web.Spock.Core: data Path (as :: [*]) (pathState :: PathState) :: [*] -> PathState -> *
+ Web.Spock.Core: data Path (as :: [Type]) (pathState :: PathState)
- Web.Spock.Core: data StdMethod :: *
+ Web.Spock.Core: data StdMethod
- Web.Spock.Core: renderRoute :: AllHave ToHttpApiData as => Path as 'Open -> HVectElim as Text
+ Web.Spock.Core: renderRoute :: AllHave ToHttpApiData as => Path as 'Open -> HVectElim as Text
- Web.Spock.Core: root :: Path [] * Open
+ Web.Spock.Core: root :: Path ('[] :: [Type]) 'Open
- Web.Spock.Core: spockT :: (MonadIO m) => (forall a. m a -> IO a) -> SpockT m () -> IO Middleware
+ Web.Spock.Core: spockT :: MonadIO m => (forall a. m a -> IO a) -> SpockT m () -> IO Middleware
- Web.Spock.Core: static :: String -> Path [] * Open
+ Web.Spock.Core: static :: String -> Path ('[] :: [Type]) 'Open
- Web.Spock.Core: type Var a = Path (:) * a [] * Open
+ Web.Spock.Core: type Var a = Path '[a] 'Open
- Web.Spock.Core: var :: (Typeable * a, FromHttpApiData a) => Path (:) * a [] * Open
+ Web.Spock.Core: var :: (Typeable a, FromHttpApiData a) => Path '[a] 'Open
- Web.Spock.Core: wildcard :: Path (:) * Text [] * Closed
+ Web.Spock.Core: wildcard :: Path '[Text] 'Closed
Files
- Spock-core.cabal +8/−6
- src/Web/Spock/Internal/Wire.hs +9/−17
Spock-core.cabal view
@@ -1,5 +1,5 @@ name: Spock-core-version: 0.13.0.0+version: 0.14.0.0 synopsis: Another Haskell web framework for rapid development description: Barebones high performance type safe web framework Homepage: https://www.spock.li@@ -8,11 +8,11 @@ license-file: LICENSE author: Alexander Thiemann <mail@athiemann.net> maintainer: Alexander Thiemann <mail@athiemann.net>-copyright: (c) 2013 - 2017 Alexander Thiemann+copyright: (c) 2013 - 2020 Alexander Thiemann category: Web build-type: Simple-cabal-version: >=1.8-tested-with: GHC==7.10.2, GHC==8.0.1+cabal-version: >=2.0+tested-with: GHC==8.8.4 extra-source-files: README.md@@ -37,16 +37,16 @@ case-insensitive >=1.1, containers >=0.5, cookie >=0.4,- directory >=1.2, hashable >=1.2, http-types >=0.8, hvect >= 0.4, monad-control >= 1.0,+ mmorph >= 1.1, mtl >=2.1, http-api-data >= 0.2, old-locale >=1.0, reroute >=0.5,- resourcet >= 0.4,+ resourcet >= 1.2.2, stm >=2.4, superbuffer >= 0.2, text >= 0.11.3.1,@@ -59,6 +59,7 @@ wai-extra >=3.0, warp >=3.0 ghc-options: -Wall -fno-warn-orphans+ default-language: Haskell2010 test-suite spockcoretests type: exitcode-stdio-1.0@@ -88,6 +89,7 @@ wai ghc-options: -Wall -fno-warn-orphans+ default-language: Haskell2010 source-repository head type: git
src/Web/Spock/Internal/Wire.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -Wno-warnings-deprecations #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-}@@ -46,9 +47,9 @@ #else import Prelude hiding (catch) #endif-import System.Directory import System.IO import Web.Routing.Router+import qualified Control.Monad.Morph as MM import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import qualified Data.ByteString.Lazy.Char8 as BSLC@@ -273,6 +274,9 @@ instance MonadTrans (ActionCtxT ctx) where lift = ActionCtxT . lift . lift +instance MM.MFunctor (ActionCtxT ctx) where+ hoist f m = ActionCtxT (MM.hoist (MM.hoist f) (runActionCtxT m))+ instance MonadTransControl (ActionCtxT ctx) where type StT (ActionCtxT ctx) a = (Either ActionInterupt a, ResponseState, ()) liftWith f =@@ -361,7 +365,7 @@ notFound = respStateToResponse $ errorResponse status404 "404 - File not found" makeActionEnvironment ::- InternalState -> SpockMethod -> Wai.Request -> IO (RequestInfo (), TVar V.Vault, IO ())+ InternalState -> SpockMethod -> Wai.Request -> IO (RequestInfo (), TVar V.Vault) makeActionEnvironment st stdMethod req = do vaultVar <- liftIO $ newTVarIO (Wai.vault req) let vaultIf =@@ -373,7 +377,7 @@ map (\(k, mV) -> (T.decodeUtf8 k, T.decodeUtf8 $ fromMaybe BS.empty mV)) $ Wai.queryString req rbValue <- newCacheVar $- do let parseBody = Wai.requestBody req+ do let parseBody = Wai.getRequestBodyChunk req bodyLength = Wai.requestBodyLength req buffStart = case bodyLength of@@ -423,19 +427,8 @@ , ri_context = () } , vaultVar- , removeUploadedFiles (rb_files reqBody) ) -removeUploadedFiles :: CacheVar (HM.HashMap k UploadedFile) -> IO ()-removeUploadedFiles uploadedFilesRef =- do cvals <- loadCacheVarOpt uploadedFilesRef- case cvals of- Nothing -> return ()- Just uploadedFiles ->- forM_ (HM.elems uploadedFiles) $ \uploadedFile ->- do stillThere <- doesFileExist (uf_tempLocation uploadedFile)- when stillThere $ liftIO $ removeFile (uf_tempLocation uploadedFile)- applyAction :: MonadIO m => SpockConfigInternal -> Wai.Request@@ -508,7 +501,7 @@ `catch` \(_ :: SizeException) -> return (Right $ getErrorHandler config status413) case actEnv of- Left (mkEnv, vaultVar, cleanUp) ->+ Left (mkEnv, vaultVar) -> do mRespState <- registryLift (applyAction config req mkEnv allActions) `catches` [ Handler $ \(_ :: SizeException) ->@@ -519,7 +512,6 @@ ++ ": " ++ show e return $ Just $ getErrorHandler config status500 ]- cleanUp case mRespState of Just (ResponseHandler responseHandler) -> responseHandler >>= \app -> app req respond@@ -546,7 +538,7 @@ do currentSize <- newIORef 0 return $ req { Wai.requestBody =- do bs <- Wai.requestBody req+ do bs <- Wai.getRequestBodyChunk req total <- atomicModifyIORef currentSize $ \sz -> let !nextSize = sz + fromIntegral (BS.length bs)