@@ -123,6 +123,7 @@ import Data.Coerce (coerce, Coercible)
123123import Data.Aeson
124124 (defaultOptions, genericToEncoding, ToJSON(..), FromJSON(..), Value)
125125import GHC.Generics (Generic)
126+import Control.Monad.IO.Unlift (MonadUnliftIO)
126127#endif
127128
128129#if MIN_VERSION_base(4,9,0) && defined(CHECK_UNCHECKED)
@@ -164,7 +165,7 @@ data JSContextRef = JSContextRef {
164165type JSM = IO
165166#else
166167newtype JSM a = JSM { unJSM :: ReaderT JSContextRef IO a }
167− deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadThrow)
168+ deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadThrow, MonadUnliftIO)
168169
169170instance MonadCatch JSM where
170171 t `catch` c = JSM (unJSM (syncAfter t) `catch` \e -> unJSM (c e))
@@ -177,6 +178,7 @@ instance MonadMask JSM where
177178 JSM $ uninterruptibleMask $ \unmask -> unJSM (a $ q unmask)
178179 where q :: (ReaderT JSContextRef IO a -> ReaderT JSContextRef IO a) -> JSM a -> JSM a
179180 q unmask (JSM b) = syncAfter . JSM $ unmask b
181+
180182#endif
181183
182184-- | Forces execution of pending asyncronous code