Workarounds for older bytestrings
This commit is contained in:
parent
e8ce5650da
commit
dfd7965b6b
@ -49,7 +49,19 @@ import Yesod.Core.Types
|
|||||||
import Yesod.Core.Internal.Request (parseWaiRequest,
|
import Yesod.Core.Internal.Request (parseWaiRequest,
|
||||||
tooLargeResponse)
|
tooLargeResponse)
|
||||||
import Yesod.Routes.Class (Route, renderRoute)
|
import Yesod.Routes.Class (Route, renderRoute)
|
||||||
import Control.DeepSeq (($!!))
|
import Control.DeepSeq (($!!), NFData)
|
||||||
|
import Control.Monad (liftM)
|
||||||
|
|
||||||
|
returnDeepSessionMap :: Monad m => SessionMap -> m SessionMap
|
||||||
|
#if MIN_VERSION_bytestring(0, 10, 0)
|
||||||
|
returnDeepSessionMap sm = return $!! sm
|
||||||
|
#else
|
||||||
|
returnDeepSessionMap sm = fmap unWrappedBS `liftM` (return $!! fmap WrappedBS sm)
|
||||||
|
|
||||||
|
-- | Work around missing NFData instance for bytestring 0.9.
|
||||||
|
newtype WrappedBS = WrappedBS { unWrappedBS :: S8.ByteString }
|
||||||
|
instance NFData WrappedBS
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Function used internally by Yesod in the process of converting a
|
-- | Function used internally by Yesod in the process of converting a
|
||||||
-- 'HandlerT' into an 'Application'. Should not be needed by users.
|
-- 'HandlerT' into an 'Application'. Should not be needed by users.
|
||||||
@ -82,7 +94,7 @@ runHandler rhe@RunHandlerEnv {..} handler yreq = withInternalState $ \resState -
|
|||||||
state <- liftIO $ I.readIORef istate
|
state <- liftIO $ I.readIORef istate
|
||||||
|
|
||||||
(finalSession, mcontents1) <- (do
|
(finalSession, mcontents1) <- (do
|
||||||
finalSession <- return $!! ghsSession state
|
finalSession <- returnDeepSessionMap (ghsSession state)
|
||||||
return (finalSession, Nothing)) `E.catch` \e -> return
|
return (finalSession, Nothing)) `E.catch` \e -> return
|
||||||
(Map.empty, Just $! HCError $! InternalError $! T.pack $! show (e :: E.SomeException))
|
(Map.empty, Just $! HCError $! InternalError $! T.pack $! show (e :: E.SomeException))
|
||||||
|
|
||||||
|
|||||||
@ -318,8 +318,8 @@ data Header =
|
|||||||
-- annotations to SetCookie in the cookie package.
|
-- annotations to SetCookie in the cookie package.
|
||||||
instance NFData Header where
|
instance NFData Header where
|
||||||
rnf (AddCookie x) = rnf x
|
rnf (AddCookie x) = rnf x
|
||||||
rnf (DeleteCookie x y) = rnf x `seq` rnf y
|
rnf (DeleteCookie x y) = x `seq` y `seq` ()
|
||||||
rnf (Header x y) = rnf x `seq` rnf y
|
rnf (Header x y) = x `seq` y `seq` ()
|
||||||
|
|
||||||
data Location url = Local url | Remote Text
|
data Location url = Local url | Remote Text
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.2.13
|
version: 1.2.13.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user