@@ -13,6 +13,7 @@
1313{-# LANGUAGE TypeFamilies #-}
1414{-# LANGUAGE TypeSynonymInstances #-}
1515{-# LANGUAGE UndecidableInstances #-}
16+{-# LANGUAGE UndecidableSuperClasses #-}
1617
1718-- | Render the first widget on the server, and the second on the client.
1819module Reflex.Dom.Prerender
@@ -81,7 +82,7 @@ prerender_
8182 => m () -> Client m () -> m ()
8283prerender_ server client = void $ prerender server client
8384
84−class PrerenderClientConstraint js t (Client m) => Prerender js t m | m -> t js where
85+class (PrerenderClientConstraint js t (Client m), Client (Client m) ~ Client m, Prerender js t m) => Prerender js t m | m -> t js where
8586 -- | Monad in which the client widget is built
8687 type Client m :: * -> *
8788 -- | Render the first widget on the server, and the second on the client. The
@@ -132,19 +133,19 @@ instance (Adjustable t m, PrerenderBaseConstraints js t m, ReflexHost t) => Prer
132133 insertBefore df =<< deleteToPrerenderEnd doc
133134 holdDyn a0 a'
134135
135−newtype UnrunnableT t m a = UnrunnableT { runUnrunnableT :: Void -> m a }
136+newtype UnrunnableT js t m a = UnrunnableT { runUnrunnableT :: Void -> m a }
136137
137−instance Functor (UnrunnableT t m) where
138+instance Functor (UnrunnableT js t m) where
138139 fmap _ _ = UnrunnableT $ \case
139−instance Applicative (UnrunnableT t m) where
140+instance Applicative (UnrunnableT js t m) where
140141 pure _ = UnrunnableT $ \case
141142 _ <*> _ = UnrunnableT $ \case
142−instance Monad (UnrunnableT t m) where
143+instance Monad (UnrunnableT js t m) where
143144 _ >>= _ = UnrunnableT $ \case
144−instance MonadTrans (UnrunnableT t) where
145+instance MonadTrans (UnrunnableT js t) where
145146 lift _ = UnrunnableT $ \case
146−instance Reflex t => DomBuilder t (UnrunnableT t m) where
147− type DomBuilderSpace (UnrunnableT t m) = GhcjsDomSpace
147+instance Reflex t => DomBuilder t (UnrunnableT js t m) where
148+ type DomBuilderSpace (UnrunnableT js t m) = GhcjsDomSpace
148149 textNode _ = UnrunnableT $ \case
149150 commentNode _ = UnrunnableT $ \case
150151 element _ _ _ = UnrunnableT $ \case
@@ -153,51 +154,54 @@ instance Reflex t => DomBuilder t (UnrunnableT t m) where
153154 selectElement _ _ = UnrunnableT $ \case
154155 placeRawElement _ = UnrunnableT $ \case
155156 wrapRawElement _ _ = UnrunnableT $ \case
156−instance NotReady t (UnrunnableT t m) where
157+instance NotReady t (UnrunnableT js t m) where
157158 notReadyUntil _ = UnrunnableT $ \case
158159 notReady = UnrunnableT $ \case
159−instance Reflex t => Adjustable t (UnrunnableT t m) where
160+instance Reflex t => Adjustable t (UnrunnableT js t m) where
160161 runWithReplace _ _ = UnrunnableT $ \case
161162 traverseIntMapWithKeyWithAdjust _ _ _ = UnrunnableT $ \case
162163 traverseDMapWithKeyWithAdjust _ _ _ = UnrunnableT $ \case
163164 traverseDMapWithKeyWithAdjustWithMove _ _ _ = UnrunnableT $ \case
164−instance Reflex t => PerformEvent t (UnrunnableT t m) where
165− type Performable (UnrunnableT t m) = UnrunnableT t m
165+instance Reflex t => PerformEvent t (UnrunnableT js t m) where
166+ type Performable (UnrunnableT js t m) = UnrunnableT js t m
166167 performEvent _ = UnrunnableT $ \case
167168 performEvent_ _ = UnrunnableT $ \case
168−instance MonadRef (UnrunnableT t m) where
169− type Ref (UnrunnableT t m) = Ref IO
169+instance MonadRef (UnrunnableT js t m) where
170+ type Ref (UnrunnableT js t m) = Ref IO
170171 newRef _ = UnrunnableT $ \case
171172 readRef _ = UnrunnableT $ \case
172173 writeRef _ _ = UnrunnableT $ \case
173−instance HasDocument (UnrunnableT t m) where
174+instance HasDocument (UnrunnableT js t m) where
174175 askDocument = UnrunnableT $ \case
175−instance HasJSContext (UnrunnableT t m) where
176− --type JsContextPhantom (UnrunnableT t m) = ()
177−instance HasJS JS' (UnrunnableT t m) where
178− type JSX (UnrunnableT t m) = UnrunnableT t m
179−instance MonadJS JS' (UnrunnableT t m) where
180−instance TriggerEvent t (UnrunnableT t m) where
181−instance MonadReflexCreateTrigger t (UnrunnableT t m) where
176+instance HasJSContext (UnrunnableT js t m) where
177+ --type JsContextPhantom (UnrunnableT js t m) = ()
178+instance HasJS JS' (UnrunnableT js t m) where
179+ type JSX (UnrunnableT js t m) = UnrunnableT js t m
180+instance MonadJS JS' (UnrunnableT js t m) where
181+instance TriggerEvent t (UnrunnableT js t m) where
182+instance MonadReflexCreateTrigger t (UnrunnableT js t m) where
182183 newEventWithTrigger _ = UnrunnableT $ \case
183−instance MonadFix (UnrunnableT t m) where
184+instance MonadFix (UnrunnableT js t m) where
184185 mfix _ = UnrunnableT $ \case
185−instance MonadHold t (UnrunnableT t m) where
186+instance MonadHold t (UnrunnableT js t m) where
186187 hold _ _ = UnrunnableT $ \case
187188 holdDyn _ _ = UnrunnableT $ \case
188189 holdIncremental _ _ = UnrunnableT $ \case
189−instance MonadSample t (UnrunnableT t m)
190−instance MonadIO (UnrunnableT t m)
191−instance MonadJSM (UnrunnableT t m) where
190+instance MonadSample t (UnrunnableT js t m)
191+instance MonadIO (UnrunnableT js t m)
192+instance MonadJSM (UnrunnableT js t m) where
192193 liftJSM' _ = UnrunnableT $ \case
193−instance Reflex t => PostBuild t (UnrunnableT t m)
194−instance PrimMonad (UnrunnableT t m) where
195−-- type RawDocument (UnrunnableT t m) = DOM.Document
196−--instance HasJSContext (UnrunnableT t m)
197−--instance MonadJSM (UnrunnableT t m)
194+instance Reflex t => PostBuild t (UnrunnableT js t m)
195+instance PrimMonad (UnrunnableT js t m) where
196+-- type RawDocument (UnrunnableT js t m) = DOM.Document
197+--instance HasJSContext (UnrunnableT js t m)
198+--instance MonadJSM (UnrunnableT js t m)
199+instance Prerender JS' t (UnrunnableT js t m) where
200+ type Client (UnrunnableT js t m) = UnrunnableT js t m
201+ prerender _ _ = UnrunnableT $ \case
198202
199203instance (SupportsStaticDomBuilder t m) => Prerender JS' t (StaticDomBuilderT t m) where
200− type Client (StaticDomBuilderT t m) = UnrunnableT t m
204+ type Client (StaticDomBuilderT t m) = UnrunnableT JS' t m
201205 prerender server _ = do
202206 _ <- commentNode $ CommentNodeConfig startMarker Nothing
203207 a <- server