From 9d0c9180b953d3a1124d1fbd0ce3e03e8df95345 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 1 Mar 2020 11:00:36 +0200 Subject: [PATCH] unliftio-core 0.2 --- yesod-core/ChangeLog.md | 4 ++++ yesod-core/src/Yesod/Core/Types.hs | 17 +++++++---------- yesod-core/yesod-core.cabal | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index f5abac1c..3b27eb4b 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-core +## 1.6.17.3 + +* Support for `unliftio-core` 0.2 + ## 1.6.17.2 * Support template-haskell 2.16, build with GHC 8.10 [#1657](https://github.com/yesodweb/yesod/pull/1657) diff --git a/yesod-core/src/Yesod/Core/Types.hs b/yesod-core/src/Yesod/Core/Types.hs index 3d4f00d3..db7c48a9 100644 --- a/yesod-core/src/Yesod/Core/Types.hs +++ b/yesod-core/src/Yesod/Core/Types.hs @@ -55,7 +55,7 @@ import Control.Monad.Reader (MonadReader (..)) import Control.DeepSeq (NFData (rnf)) import Yesod.Core.TypeCache (TypeMap, KeyedTypeMap) import Control.Monad.Logger (MonadLoggerIO (..)) -import UnliftIO (MonadUnliftIO (..), UnliftIO (..)) +import UnliftIO (MonadUnliftIO (..)) -- Sessions type SessionMap = Map Text ByteString @@ -437,9 +437,8 @@ instance PrimMonad (WidgetFor site) where primitive = liftIO . primitive -- | @since 1.4.38 instance MonadUnliftIO (WidgetFor site) where - {-# INLINE askUnliftIO #-} - askUnliftIO = WidgetFor $ \wd -> - return (UnliftIO (flip unWidgetFor wd)) + {-# INLINE withRunInIO #-} + withRunInIO inner = WidgetFor $ \x -> inner $ flip unWidgetFor x instance MonadReader (WidgetData site) (WidgetFor site) where ask = WidgetFor return local f (WidgetFor g) = WidgetFor $ g . f @@ -476,9 +475,8 @@ instance MonadReader (HandlerData site site) (HandlerFor site) where -- | @since 1.4.38 instance MonadUnliftIO (HandlerFor site) where - {-# INLINE askUnliftIO #-} - askUnliftIO = HandlerFor $ \r -> - return (UnliftIO (flip unHandlerFor r)) + {-# INLINE withRunInIO #-} + withRunInIO inner = HandlerFor $ \x -> inner $ flip unHandlerFor x instance MonadThrow (HandlerFor site) where throwM = liftIO . throwM @@ -549,9 +547,8 @@ instance MonadReader (HandlerData child master) (SubHandlerFor child master) whe -- | @since 1.4.38 instance MonadUnliftIO (SubHandlerFor child master) where - {-# INLINE askUnliftIO #-} - askUnliftIO = SubHandlerFor $ \r -> - return (UnliftIO (flip unSubHandlerFor r)) + {-# INLINE withRunInIO #-} + withRunInIO inner = SubHandlerFor $ \x -> inner $ flip unSubHandlerFor x instance MonadThrow (SubHandlerFor child master) where throwM = liftIO . throwM diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index bc53d920..7a653e34 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.6.17.2 +version: 1.6.17.3 license: MIT license-file: LICENSE author: Michael Snoyman