@@ -16,6 +16,7 @@ module Reflex.Query.Base
16 , mapQueryResult
16 , mapQueryResult
17 , dynWithQueryT
17 , dynWithQueryT
18 , withQueryT
18 , withQueryT
21import Control.Applicative (liftA2)
22import Control.Applicative (liftA2)
@@ -287,6 +288,10 @@ withQueryT f a = do
287 (fmapCheap (AdditivePatch . mapQuery f . unAdditivePatch) $ updatedIncremental q)
288 (fmapCheap (AdditivePatch . mapQuery f . unAdditivePatch) $ updatedIncremental q)
288 return result
289 return result
291+-- | Maps a function over a 'QueryT' that can change the underlying monad
292+mapQueryT :: (forall b. m b -> n b) -> QueryT t q m a -> QueryT t q n a
293+mapQueryT f (QueryT a) = QueryT $ mapStateT (mapEventWriterT (mapReaderT f)) a
290-- | dynWithQueryT's (Dynamic t QueryMorphism) argument needs to be a group homomorphism at all times in order to behave correctly
295-- | dynWithQueryT's (Dynamic t QueryMorphism) argument needs to be a group homomorphism at all times in order to behave correctly
291dynWithQueryT :: (MonadFix m, PostBuild t m, Group q, Additive q, Group q', Additive q', Query q')
296dynWithQueryT :: (MonadFix m, PostBuild t m, Group q, Additive q, Group q', Additive q', Query q')
292 => Dynamic t (QueryMorphism q q')
297 => Dynamic t (QueryMorphism q q')