Add PrimMonad instances
Pointed out at: https://stackoverflow.com/q/52692508/369198
This commit is contained in:
parent
1c2cb0c717
commit
55e0ca4bc3
@ -1,3 +1,10 @@
|
|||||||
|
# ChangeLog for yesod-core
|
||||||
|
|
||||||
|
## 1.6.9
|
||||||
|
|
||||||
|
* Add `PrimMonad` instances for `HandlerFor` and `WidgetFor` [from
|
||||||
|
StackOverflow](https://stackoverflow.com/q/52692508/369198)
|
||||||
|
|
||||||
## 1.6.8
|
## 1.6.8
|
||||||
|
|
||||||
* Sets the `X-XSS-Protection` header to `1; mode=block` [#1550](https://github.com/yesodweb/yesod/pull/1550)
|
* Sets the `X-XSS-Protection` header to `1; mode=block` [#1550](https://github.com/yesodweb/yesod/pull/1550)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import Control.Monad (ap)
|
|||||||
import Control.Monad.IO.Class (MonadIO (liftIO))
|
import Control.Monad.IO.Class (MonadIO (liftIO))
|
||||||
import Control.Monad.Logger (LogLevel, LogSource,
|
import Control.Monad.Logger (LogLevel, LogSource,
|
||||||
MonadLogger (..))
|
MonadLogger (..))
|
||||||
|
import Control.Monad.Primitive (PrimMonad (..))
|
||||||
import Control.Monad.Trans.Resource (MonadResource (..), InternalState, runInternalState, MonadThrow (..), ResourceT)
|
import Control.Monad.Trans.Resource (MonadResource (..), InternalState, runInternalState, MonadThrow (..), ResourceT)
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
@ -417,6 +418,10 @@ instance Monad (WidgetFor site) where
|
|||||||
unWidgetFor (f a) wd
|
unWidgetFor (f a) wd
|
||||||
instance MonadIO (WidgetFor site) where
|
instance MonadIO (WidgetFor site) where
|
||||||
liftIO = WidgetFor . const
|
liftIO = WidgetFor . const
|
||||||
|
-- | @since 1.6.9
|
||||||
|
instance PrimMonad (WidgetFor site) where
|
||||||
|
type PrimState (WidgetFor site) = PrimState IO
|
||||||
|
primitive = liftIO . primitive
|
||||||
-- | @since 1.4.38
|
-- | @since 1.4.38
|
||||||
instance MonadUnliftIO (WidgetFor site) where
|
instance MonadUnliftIO (WidgetFor site) where
|
||||||
{-# INLINE askUnliftIO #-}
|
{-# INLINE askUnliftIO #-}
|
||||||
@ -448,6 +453,10 @@ instance Monad (HandlerFor site) where
|
|||||||
HandlerFor x >>= f = HandlerFor $ \r -> x r >>= \x' -> unHandlerFor (f x') r
|
HandlerFor x >>= f = HandlerFor $ \r -> x r >>= \x' -> unHandlerFor (f x') r
|
||||||
instance MonadIO (HandlerFor site) where
|
instance MonadIO (HandlerFor site) where
|
||||||
liftIO = HandlerFor . const
|
liftIO = HandlerFor . const
|
||||||
|
-- | @since 1.6.9
|
||||||
|
instance PrimMonad (HandlerFor site) where
|
||||||
|
type PrimState (HandlerFor site) = PrimState IO
|
||||||
|
primitive = liftIO . primitive
|
||||||
instance MonadReader (HandlerData site site) (HandlerFor site) where
|
instance MonadReader (HandlerData site site) (HandlerFor site) where
|
||||||
ask = HandlerFor return
|
ask = HandlerFor return
|
||||||
local f (HandlerFor g) = HandlerFor $ g . f
|
local f (HandlerFor g) = HandlerFor $ g . f
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.6.8
|
version: 1.6.9
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -42,6 +42,7 @@ library
|
|||||||
, mtl
|
, mtl
|
||||||
, parsec >= 2 && < 3.2
|
, parsec >= 2 && < 3.2
|
||||||
, path-pieces >= 0.1.2 && < 0.3
|
, path-pieces >= 0.1.2 && < 0.3
|
||||||
|
, primitive >= 0.6
|
||||||
, random >= 1.0.0.2 && < 1.2
|
, random >= 1.0.0.2 && < 1.2
|
||||||
, resourcet >= 1.2
|
, resourcet >= 1.2
|
||||||
, rio
|
, rio
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user