@@ -68,6 +68,7 @@ import Control.Monad
68import Control.Monad.Exception
68import Control.Monad.Exception
69import Control.Monad.Fix
69import Control.Monad.Fix
70import Control.Monad.IO.Class
70import Control.Monad.IO.Class
71+import Control.Monad.Primitive
71import Control.Monad.Reader
72import Control.Monad.Reader
72import Control.Monad.Ref
73import Control.Monad.Ref
73import Control.Monad.State
74import Control.Monad.State
@@ -110,8 +111,16 @@ instance HasWebView m => HasWebView (DynamicWriterT t w m) where
110 type WebViewPhantom (DynamicWriterT t w m) = WebViewPhantom m
111 type WebViewPhantom (DynamicWriterT t w m) = WebViewPhantom m
111 askWebView = lift askWebView
112 askWebView = lift askWebView
114+instance HasWebView m => HasWebView (RequestT t request response m) where
115+ type WebViewPhantom (RequestT t request response m) = WebViewPhantom m
116+ askWebView = lift askWebView
113newtype WithWebView x m a = WithWebView { unWithWebView :: ReaderT (WebViewSingleton x) m a } deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadTrans, MonadException, MonadAsyncException)
118newtype WithWebView x m a = WithWebView { unWithWebView :: ReaderT (WebViewSingleton x) m a } deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadTrans, MonadException, MonadAsyncException)
120+instance PrimMonad m => PrimMonad (WithWebView x m) where
121+ type PrimState (WithWebView x m) = PrimState m
122+ primitive = lift . primitive
115instance MonadAdjust t m => MonadAdjust t (WithWebView x m) where
124instance MonadAdjust t m => MonadAdjust t (WithWebView x m) where
116 sequenceDMapWithAdjust dm0 dm' = WithWebView $ sequenceDMapWithAdjust (coerce dm0) (unsafeCoerce dm')
125 sequenceDMapWithAdjust dm0 dm' = WithWebView $ sequenceDMapWithAdjust (coerce dm0) (unsafeCoerce dm')
@@ -218,6 +227,10 @@ instance HasJS x m => HasJS x (DynamicWriterT t w m) where
218 type JSM (DynamicWriterT t w m) = JSM m
227 type JSM (DynamicWriterT t w m) = JSM m
219 liftJS = lift . liftJS
228 liftJS = lift . liftJS
230+instance HasJS x m => HasJS x (RequestT t request response m) where
231+ type JSM (RequestT t request response m) = JSM m
232+ liftJS = lift . liftJS
221-- | A Monad that is capable of executing JavaScript
234-- | A Monad that is capable of executing JavaScript
222class Monad m => MonadJS x m | m -> x where
235class Monad m => MonadJS x m | m -> x where
223 runJS :: JSFFI -> [JSRef x] -> m (JSRef x)
236 runJS :: JSFFI -> [JSRef x] -> m (JSRef x)