on develop help sign in
Merge branch 'develop' into fix-nixpkgs-tests
38e791bAli Abrar
Quickref.md+1
@@ -54,6 +54,7 @@ Since MonadHold depends on MonadSample, any [S] function also runs in [H] contex
54[ ] difference :: Event a -> Event b -> Event a
54[ ] difference :: Event a -> Event b -> Event a
55[ ] align :: Event a -> Event b -> Event (These a b)
55[ ] align :: Event a -> Event b -> Event (These a b)
56[ ] alignWith :: (These a b -> c) -> Event a -> Event b -> Event c
56[ ] alignWith :: (These a b -> c) -> Event a -> Event b -> Event c
57+ -- Note align functions from Data.Align in semialign package
57[ ] mergeWith :: (a -> a -> a) -> [Event a] -> Event a
58[ ] mergeWith :: (a -> a -> a) -> [Event a] -> Event a
58[ ] leftmost :: [Event a] -> Event a
59[ ] leftmost :: [Event a] -> Event a
59[ ] mergeList :: [Event a] -> Event (NonEmpty a)
60[ ] mergeList :: [Event a] -> Event (NonEmpty a)
reflex.cabal+10−1
@@ -77,9 +77,10 @@ library
77 constraints-extras >= 0.3 && < 0.4,
77 constraints-extras >= 0.3 && < 0.4,
78 containers >= 0.6 && < 0.7,
78 containers >= 0.6 && < 0.7,
79 data-default >= 0.5 && < 0.8,
79 data-default >= 0.5 && < 0.8,
80− dependent-map >= 0.3 && < 0.4,
80+ dependent-map >= 0.3 && < 0.5,
81 exception-transformers == 0.4.*,
81 exception-transformers == 0.4.*,
82 lens >= 4.7 && < 5,
82 lens >= 4.7 && < 5,
83+ mmorph >= 1.0 && < 1.2,
83 monad-control >= 1.0.1 && < 1.1,
84 monad-control >= 1.0.1 && < 1.1,
84 mtl >= 2.1 && < 2.3,
85 mtl >= 2.1 && < 2.3,
85 patch >= 0.0.1 && < 0.1,
86 patch >= 0.0.1 && < 0.1,
@@ -344,6 +345,14 @@ test-suite RequesterT
344 Reflex.Plan.Pure
345 Reflex.Plan.Pure
345 Test.Run
346 Test.Run
346
347
348+test-suite Headless
349+ default-language: Haskell2010
350+ type: exitcode-stdio-1.0
351+ main-is: Headless.hs
352+ hs-source-dirs: test
353+ build-depends: base
354+ , reflex
355+
347test-suite Adjustable
356test-suite Adjustable
348 default-language: Haskell2010
357 default-language: Haskell2010
349 type: exitcode-stdio-1.0
358 type: exitcode-stdio-1.0
src/Reflex/Adjustable/Class.hs+2−1
@@ -30,7 +30,8 @@ module Reflex.Adjustable.Class
30
30
31import Control.Monad.Identity
31import Control.Monad.Identity
32import Control.Monad.Reader
32import Control.Monad.Reader
33−import Data.Dependent.Map (DMap, GCompare (..))
33+import Data.Dependent.Map (DMap)
34+import Data.GADT.Compare (GCompare(..))
34import qualified Data.Dependent.Map as DMap
35import qualified Data.Dependent.Map as DMap
35import Data.Functor.Constant
36import Data.Functor.Constant
36import Data.Functor.Misc
37import Data.Functor.Misc
src/Reflex/BehaviorWriter/Base.hs+13−4
@@ -24,6 +24,7 @@ module Reflex.BehaviorWriter.Base
24import Control.Monad.Exception
24import Control.Monad.Exception
25import Control.Monad.Identity
25import Control.Monad.Identity
26import Control.Monad.IO.Class
26import Control.Monad.IO.Class
27+import Control.Monad.Morph
27import Control.Monad.Reader
28import Control.Monad.Reader
28import Control.Monad.Ref
29import Control.Monad.Ref
29import Control.Monad.State.Strict
30import Control.Monad.State.Strict
@@ -48,7 +49,18 @@ import Reflex.TriggerEvent.Class
48
49
49-- | A basic implementation of 'BehaviorWriter'.
50-- | A basic implementation of 'BehaviorWriter'.
50newtype BehaviorWriterT t w m a = BehaviorWriterT { unBehaviorWriterT :: StateT [Behavior t w] m a }
51newtype BehaviorWriterT t w m a = BehaviorWriterT { unBehaviorWriterT :: StateT [Behavior t w] m a }
51− deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order
52+ -- The list is kept in reverse order
53+ deriving
54+ ( Functor
55+ , Applicative
56+ , Monad
57+ , MonadTrans
58+ , MFunctor
59+ , MonadIO
60+ , MonadFix
61+ , MonadAsyncException
62+ , MonadException
63+ )
52
64
53-- | Run a 'BehaviorWriterT' action. The behavior writer output will be provided
65-- | Run a 'BehaviorWriterT' action. The behavior writer output will be provided
54-- along with the result of the action.
66-- along with the result of the action.
@@ -73,9 +85,6 @@ withBehaviorWriterT f dw = do
73deriving instance MonadHold t m => MonadHold t (BehaviorWriterT t w m)
85deriving instance MonadHold t m => MonadHold t (BehaviorWriterT t w m)
74deriving instance MonadSample t m => MonadSample t (BehaviorWriterT t w m)
86deriving instance MonadSample t m => MonadSample t (BehaviorWriterT t w m)
75
87
76−instance MonadTrans (BehaviorWriterT t w) where
77− lift = BehaviorWriterT . lift
78−
79instance MonadRef m => MonadRef (BehaviorWriterT t w m) where
88instance MonadRef m => MonadRef (BehaviorWriterT t w m) where
80 type Ref (BehaviorWriterT t w m) = Ref m
89 type Ref (BehaviorWriterT t w m) = Ref m
81 newRef = lift . newRef
90 newRef = lift . newRef
src/Reflex/Class.hs+2−1
@@ -196,7 +196,8 @@ import Data.Align
196import Data.Bifunctor
196import Data.Bifunctor
197import Data.Coerce
197import Data.Coerce
198import Data.Default
198import Data.Default
199−import Data.Dependent.Map (DMap, DSum (..))
199+import Data.Dependent.Map (DMap)
200+import Data.Dependent.Sum (DSum (..))
200import qualified Data.Dependent.Map as DMap
201import qualified Data.Dependent.Map as DMap
201import Data.Functor.Compose
202import Data.Functor.Compose
202import Data.Functor.Product
203import Data.Functor.Product
src/Reflex/DynamicWriter/Base.hs+13−4
@@ -22,6 +22,7 @@ module Reflex.DynamicWriter.Base
22import Control.Monad.Exception
22import Control.Monad.Exception
23import Control.Monad.Identity
23import Control.Monad.Identity
24import Control.Monad.IO.Class
24import Control.Monad.IO.Class
25+import Control.Monad.Morph
25import Control.Monad.Primitive
26import Control.Monad.Primitive
26import Control.Monad.Reader
27import Control.Monad.Reader
27import Control.Monad.Ref
28import Control.Monad.Ref
@@ -51,9 +52,6 @@ import Reflex.Query.Class
51import Reflex.Requester.Class
52import Reflex.Requester.Class
52import Reflex.TriggerEvent.Class
53import Reflex.TriggerEvent.Class
53
54
54−instance MonadTrans (DynamicWriterT t w) where
55− lift = DynamicWriterT . lift
56−
57mapIncrementalMapValues :: (Reflex t, Patch (p v), Patch (p v'), PatchTarget (p v) ~ f v, PatchTarget (p v') ~ f v', Functor p, Functor f) => (v -> v') -> Incremental t (p v) -> Incremental t (p v')
55mapIncrementalMapValues :: (Reflex t, Patch (p v), Patch (p v'), PatchTarget (p v) ~ f v, PatchTarget (p v') ~ f v', Functor p, Functor f) => (v -> v') -> Incremental t (p v) -> Incremental t (p v')
58mapIncrementalMapValues f = unsafeMapIncremental (fmap f) (fmap f)
56mapIncrementalMapValues f = unsafeMapIncremental (fmap f) (fmap f)
59
57
@@ -90,7 +88,18 @@ mergeDynIncrementalWithMove a = unsafeBuildIncremental (mapM (sample . current)
90
88
91-- | A basic implementation of 'DynamicWriter'.
89-- | A basic implementation of 'DynamicWriter'.
92newtype DynamicWriterT t w m a = DynamicWriterT { unDynamicWriterT :: StateT [Dynamic t w] m a }
90newtype DynamicWriterT t w m a = DynamicWriterT { unDynamicWriterT :: StateT [Dynamic t w] m a }
93− deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order
91+ -- The list is kept in reverse order
92+ deriving
93+ ( Functor
94+ , Applicative
95+ , Monad
96+ , MonadTrans
97+ , MFunctor
98+ , MonadIO
99+ , MonadFix
100+ , MonadAsyncException
101+ , MonadException
102+ )
94
103
95deriving instance MonadHold t m => MonadHold t (DynamicWriterT t w m)
104deriving instance MonadHold t m => MonadHold t (DynamicWriterT t w m)
96deriving instance MonadSample t m => MonadSample t (DynamicWriterT t w m)
105deriving instance MonadSample t m => MonadSample t (DynamicWriterT t w m)
src/Reflex/EventWriter/Base.hs+14−5
@@ -35,12 +35,14 @@ import Reflex.TriggerEvent.Class
35
35
36import Control.Monad.Exception
36import Control.Monad.Exception
37import Control.Monad.Identity
37import Control.Monad.Identity
38+import Control.Monad.Morph
38import Control.Monad.Primitive
39import Control.Monad.Primitive
39import Control.Monad.Reader
40import Control.Monad.Reader
40import Control.Monad.Ref
41import Control.Monad.Ref
41import Control.Monad.State.Strict
42import Control.Monad.State.Strict
42−import Data.Dependent.Map (DMap, DSum (..))
43+import Data.Dependent.Map (DMap)
43import qualified Data.Dependent.Map as DMap
44import qualified Data.Dependent.Map as DMap
45+import Data.Dependent.Sum (DSum (..))
44import Data.Functor.Compose
46import Data.Functor.Compose
45import Data.Functor.Misc
47import Data.Functor.Misc
46import Data.GADT.Compare (GCompare (..), GEq (..), GOrdering (..))
48import Data.GADT.Compare (GCompare (..), GEq (..), GOrdering (..))
@@ -96,7 +98,17 @@ data EventWriterState t w = EventWriterState
96
98
97-- | A basic implementation of 'EventWriter'.
99-- | A basic implementation of 'EventWriter'.
98newtype EventWriterT t w m a = EventWriterT { unEventWriterT :: StateT (EventWriterState t w) m a }
100newtype EventWriterT t w m a = EventWriterT { unEventWriterT :: StateT (EventWriterState t w) m a }
99− deriving (Functor, Applicative, Monad, MonadFix, MonadIO, MonadException, MonadAsyncException)
101+ deriving
102+ ( Functor
103+ , Applicative
104+ , Monad
105+ , MonadTrans
106+ , MFunctor
107+ , MonadFix
108+ , MonadIO
109+ , MonadException
110+ , MonadAsyncException
111+ )
100
112
101-- | Run a 'EventWriterT' action.
113-- | Run a 'EventWriterT' action.
102runEventWriterT :: forall t m w a. (Reflex t, Monad m, Semigroup w) => EventWriterT t w m a -> m (a, Event t w)
114runEventWriterT :: forall t m w a. (Reflex t, Monad m, Semigroup w) => EventWriterT t w m a -> m (a, Event t w)
@@ -116,9 +128,6 @@ instance (Reflex t, Monad m, Semigroup w) => EventWriter t w (EventWriterT t w m
116 , _eventWriterState_told = (tellId myId :=> w) : _eventWriterState_told old
128 , _eventWriterState_told = (tellId myId :=> w) : _eventWriterState_told old
117 }
129 }
118
130
119−instance MonadTrans (EventWriterT t w) where
120− lift = EventWriterT . lift
121−
122instance MonadSample t m => MonadSample t (EventWriterT t w m) where
131instance MonadSample t m => MonadSample t (EventWriterT t w m) where
123 sample = lift . sample
132 sample = lift . sample
124
133
src/Reflex/Host/Headless.hs+11−9
@@ -7,6 +7,7 @@
7module Reflex.Host.Headless where
7module Reflex.Host.Headless where
8
8
9import Control.Concurrent.Chan (newChan, readChan)
9import Control.Concurrent.Chan (newChan, readChan)
10+import Control.Monad (unless)
10import Control.Monad.Fix (MonadFix, fix)
11import Control.Monad.Fix (MonadFix, fix)
11import Control.Monad.IO.Class (MonadIO, liftIO)
12import Control.Monad.IO.Class (MonadIO, liftIO)
12import Control.Monad.Primitive (PrimMonad)
13import Control.Monad.Primitive (PrimMonad)
@@ -15,7 +16,7 @@ import Data.Dependent.Sum (DSum (..), (==>))
15import Data.Foldable (for_)
16import Data.Foldable (for_)
16import Data.Functor.Identity (Identity(..))
17import Data.Functor.Identity (Identity(..))
17import Data.IORef (IORef, readIORef)
18import Data.IORef (IORef, readIORef)
18−import Data.Maybe (catMaybes)
19+import Data.Maybe (catMaybes, fromMaybe)
19import Data.Traversable (for)
20import Data.Traversable (for)
20
21
21import Reflex
22import Reflex
@@ -82,32 +83,33 @@ runHeadlessApp guest =
82 -- 'Nothing' if the guest application hasn't subscribed to this event.
83 -- 'Nothing' if the guest application hasn't subscribed to this event.
83 mPostBuildTrigger <- readRef postBuildTriggerRef
84 mPostBuildTrigger <- readRef postBuildTriggerRef
84
85
85− -- When there is a subscriber to the post-build event, fire the event.
86− for_ mPostBuildTrigger $ \postBuildTrigger ->
87− fire [postBuildTrigger :=> Identity ()] $ pure ()
88−
89 -- Subscribe to an 'Event' of that the guest application can use to
86 -- Subscribe to an 'Event' of that the guest application can use to
90 -- request application shutdown. We'll check whether this 'Event' is firing
87 -- request application shutdown. We'll check whether this 'Event' is firing
91 -- to determine whether to terminate.
88 -- to determine whether to terminate.
92 shutdown <- subscribeEvent result
89 shutdown <- subscribeEvent result
93
90
91+ -- When there is a subscriber to the post-build event, fire the event.
92+ soa <- for mPostBuildTrigger $ \postBuildTrigger ->
93+ fire [postBuildTrigger :=> Identity ()] $ isFiring shutdown
94+
94 -- The main application loop. We wait for new events and fire those that
95 -- The main application loop. We wait for new events and fire those that
95 -- have subscribers. If we detect a shutdown request, the application
96 -- have subscribers. If we detect a shutdown request, the application
96 -- terminates.
97 -- terminates.
97− fix $ \loop -> do
98+ unless (or (fromMaybe [] soa)) $ fix $ \loop -> do
98 -- Read the next event (blocking).
99 -- Read the next event (blocking).
99 ers <- liftIO $ readChan events
100 ers <- liftIO $ readChan events
100 stop <- do
101 stop <- do
101 -- Fire events that have subscribers.
102 -- Fire events that have subscribers.
102 fireEventTriggerRefs fc ers $
103 fireEventTriggerRefs fc ers $
103 -- Check if the shutdown 'Event' is firing.
104 -- Check if the shutdown 'Event' is firing.
104− readEvent shutdown >>= \case
105+ isFiring shutdown
105− Nothing -> pure False
106− Just _ -> pure True
107 if or stop
106 if or stop
108 then pure ()
107 then pure ()
109 else loop
108 else loop
110 where
109 where
110+ isFiring ev = readEvent ev >>= \case
111+ Nothing -> pure False
112+ Just _ -> pure True
111 -- Use the given 'FireCommand' to fire events that have subscribers
113 -- Use the given 'FireCommand' to fire events that have subscribers
112 -- and call the callback for the 'TriggerInvocation' of each.
114 -- and call the callback for the 'TriggerInvocation' of each.
113 fireEventTriggerRefs
115 fireEventTriggerRefs
src/Reflex/Profiled.hs+2−1
@@ -28,7 +28,8 @@ import Control.Monad.Ref
28import Control.Monad.State.Strict (StateT, execStateT, modify)
28import Control.Monad.State.Strict (StateT, execStateT, modify)
29import Data.Bifunctor
29import Data.Bifunctor
30import Data.Coerce
30import Data.Coerce
31−import Data.Dependent.Map (DMap, GCompare)
31+import Data.Dependent.Map (DMap)
32+import Data.GADT.Compare (GCompare)
32import Data.FastMutableIntMap
33import Data.FastMutableIntMap
33import Data.IORef
34import Data.IORef
34import Data.List
35import Data.List
src/Reflex/Pure.hs+2−1
@@ -32,7 +32,8 @@ module Reflex.Pure
32 ) where
32 ) where
33
33
34import Control.Monad
34import Control.Monad
35−import Data.Dependent.Map (DMap, GCompare)
35+import Data.Dependent.Map (DMap)
36+import Data.GADT.Compare (GCompare)
36import qualified Data.Dependent.Map as DMap
37import qualified Data.Dependent.Map as DMap
37import Data.IntMap (IntMap)
38import Data.IntMap (IntMap)
38import qualified Data.IntMap as IntMap
39import qualified Data.IntMap as IntMap
src/Reflex/Query/Base.hs+9−3
@@ -22,16 +22,19 @@ module Reflex.Query.Base
22import Control.Applicative (liftA2)
22import Control.Applicative (liftA2)
23import Control.Monad.Exception
23import Control.Monad.Exception
24import Control.Monad.Fix
24import Control.Monad.Fix
25+import Control.Monad.Morph
25import Control.Monad.Primitive
26import Control.Monad.Primitive
26import Control.Monad.Reader
27import Control.Monad.Reader
27import Control.Monad.Ref
28import Control.Monad.Ref
28import Control.Monad.State.Strict
29import Control.Monad.State.Strict
29import Data.Align
30import Data.Align
30−import Data.Dependent.Map (DMap, DSum (..))
31+import Data.Dependent.Map (DMap)
31import qualified Data.Dependent.Map as DMap
32import qualified Data.Dependent.Map as DMap
33+import Data.Dependent.Sum (DSum(..))
32import Data.Foldable
34import Data.Foldable
33import Data.Functor.Compose
35import Data.Functor.Compose
34import Data.Functor.Misc
36import Data.Functor.Misc
37+import Data.GADT.Compare (GCompare)
35import Data.IntMap (IntMap)
38import Data.IntMap (IntMap)
36import qualified Data.IntMap as IntMap
39import qualified Data.IntMap as IntMap
37import Data.Map (Map)
40import Data.Map (Map)
@@ -135,7 +138,7 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
135 tellQueryIncremental $ unsafeBuildIncremental (fold <$> mapM sampleBs liftedBs0) qpatch
138 tellQueryIncremental $ unsafeBuildIncremental (fold <$> mapM sampleBs liftedBs0) qpatch
136 return (liftedResult0, liftedResult')
139 return (liftedResult0, liftedResult')
137
140
138− traverseDMapWithKeyWithAdjust :: forall (k :: * -> *) v v'. (DMap.GCompare k) => (forall a. k a -> v a -> QueryT t q m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> QueryT t q m (DMap k v', Event t (PatchDMap k v'))
141+ traverseDMapWithKeyWithAdjust :: forall (k :: * -> *) v v'. (GCompare k) => (forall a. k a -> v a -> QueryT t q m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> QueryT t q m (DMap k v', Event t (PatchDMap k v'))
139 traverseDMapWithKeyWithAdjust f dm0 dm' = do
142 traverseDMapWithKeyWithAdjust f dm0 dm' = do
140 let f' :: forall a. k a -> v a -> EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m) (Compose (QueryTLoweredResult t q) v' a)
143 let f' :: forall a. k a -> v a -> EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m) (Compose (QueryTLoweredResult t q) v' a)
141 f' k v = fmap (Compose . QueryTLoweredResult) $ flip runStateT [] $ unQueryT $ f k v
144 f' k v = fmap (Compose . QueryTLoweredResult) $ flip runStateT [] $ unQueryT $ f k v
@@ -180,7 +183,7 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
180 tellQueryIncremental $ unsafeBuildIncremental (fold <$> mapM sampleBs liftedBs0) qpatch
183 tellQueryIncremental $ unsafeBuildIncremental (fold <$> mapM sampleBs liftedBs0) qpatch
181 return (liftedResult0, liftedResult')
184 return (liftedResult0, liftedResult')
182
185
183− traverseDMapWithKeyWithAdjustWithMove :: forall (k :: * -> *) v v'. (DMap.GCompare k) => (forall a. k a -> v a -> QueryT t q m (v' a)) -> DMap k v -> Event t (PatchDMapWithMove k v) -> QueryT t q m (DMap k v', Event t (PatchDMapWithMove k v'))
186+ traverseDMapWithKeyWithAdjustWithMove :: forall (k :: * -> *) v v'. (GCompare k) => (forall a. k a -> v a -> QueryT t q m (v' a)) -> DMap k v -> Event t (PatchDMapWithMove k v) -> QueryT t q m (DMap k v', Event t (PatchDMapWithMove k v'))
184 traverseDMapWithKeyWithAdjustWithMove f dm0 dm' = do
187 traverseDMapWithKeyWithAdjustWithMove f dm0 dm' = do
185 let f' :: forall a. k a -> v a -> EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m) (Compose (QueryTLoweredResult t q) v' a)
188 let f' :: forall a. k a -> v a -> EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m) (Compose (QueryTLoweredResult t q) v' a)
186 f' k v = fmap (Compose . QueryTLoweredResult) $ flip runStateT [] $ unQueryT $ f k v
189 f' k v = fmap (Compose . QueryTLoweredResult) $ flip runStateT [] $ unQueryT $ f k v
@@ -237,6 +240,9 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
237instance MonadTrans (QueryT t q) where
240instance MonadTrans (QueryT t q) where
238 lift = QueryT . lift . lift . lift
241 lift = QueryT . lift . lift . lift
239
242
243+instance MFunctor (QueryT t q) where
244+ hoist = mapQueryT
245+
240instance PrimMonad m => PrimMonad (QueryT t q m) where
246instance PrimMonad m => PrimMonad (QueryT t q m) where
241 type PrimState (QueryT t q m) = PrimState m
247 type PrimState (QueryT t q m) = PrimState m
242 primitive = lift . primitive
248 primitive = lift . primitive
src/Reflex/Requester/Base.hs+6−1
@@ -49,14 +49,16 @@ import Reflex.TriggerEvent.Class
49import Control.Applicative (liftA2)
49import Control.Applicative (liftA2)
50import Control.Monad.Exception
50import Control.Monad.Exception
51import Control.Monad.Identity
51import Control.Monad.Identity
52+import Control.Monad.Morph
52import Control.Monad.Primitive
53import Control.Monad.Primitive
53import Control.Monad.Reader
54import Control.Monad.Reader
54import Control.Monad.Ref
55import Control.Monad.Ref
55import Control.Monad.State.Strict
56import Control.Monad.State.Strict
56import Data.Bits
57import Data.Bits
57import Data.Coerce
58import Data.Coerce
58−import Data.Dependent.Map (DMap, DSum (..))
59+import Data.Dependent.Map (DMap)
59import qualified Data.Dependent.Map as DMap
60import qualified Data.Dependent.Map as DMap
61+import Data.Dependent.Sum (DSum (..))
60import Data.Functor.Compose
62import Data.Functor.Compose
61import Data.Functor.Misc
63import Data.Functor.Misc
62import Data.IntMap.Strict (IntMap)
64import Data.IntMap.Strict (IntMap)
@@ -316,6 +318,9 @@ responseFromTag (MyTagWrap t) = do
316instance MonadTrans (RequesterT t request response) where
318instance MonadTrans (RequesterT t request response) where
317 lift = RequesterT . lift . lift
319 lift = RequesterT . lift . lift
318
320
321+instance MFunctor (RequesterT t request response) where
322+ hoist f = RequesterT . hoist (hoist f) . unRequesterT
323+
319instance PerformEvent t m => PerformEvent t (RequesterT t request response m) where
324instance PerformEvent t m => PerformEvent t (RequesterT t request response m) where
320 type Performable (RequesterT t request response m) = Performable m
325 type Performable (RequesterT t request response m) = Performable m
321 performEvent_ = lift . performEvent_
326 performEvent_ = lift . performEvent_
src/Reflex/Spider/Internal.hs+2−1
@@ -46,8 +46,9 @@ import Control.Monad.Fail (MonadFail)
46import qualified Control.Monad.Fail as MonadFail
46import qualified Control.Monad.Fail as MonadFail
47import Data.Align
47import Data.Align
48import Data.Coerce
48import Data.Coerce
49−import Data.Dependent.Map (DMap, DSum (..))
49+import Data.Dependent.Map (DMap)
50import qualified Data.Dependent.Map as DMap
50import qualified Data.Dependent.Map as DMap
51+import Data.Dependent.Sum (DSum (..))
51import Data.FastMutableIntMap (FastMutableIntMap, PatchIntMap (..))
52import Data.FastMutableIntMap (FastMutableIntMap, PatchIntMap (..))
52import qualified Data.FastMutableIntMap as FastMutableIntMap
53import qualified Data.FastMutableIntMap as FastMutableIntMap
53import Data.Foldable hiding (concat, elem, sequence_)
54import Data.Foldable hiding (concat, elem, sequence_)
test/Headless.hsnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Reflex
4+import Reflex.Host.Headless (runHeadlessApp)
5+
6+main :: IO ()
7+main = do
8+ runHeadlessApp $ do
9+ pb <- getPostBuild
10+ performEvent (pure <$> pb)
test/Reflex/Test/CrossImpl.hs+1−1
@@ -26,7 +26,7 @@ import qualified Reflex.Profiled as Prof
26import Control.Arrow (second, (&&&))
26import Control.Arrow (second, (&&&))
27import Control.Monad.Identity hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
27import Control.Monad.Identity hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
28import Control.Monad.State.Strict hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
28import Control.Monad.State.Strict hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
29−import Data.Dependent.Map (DSum (..))
29+import Data.Dependent.Sum (DSum (..))
30import Data.Foldable
30import Data.Foldable
31import Data.Map.Strict (Map)
31import Data.Map.Strict (Map)
32import qualified Data.Map.Strict as Map
32import qualified Data.Map.Strict as Map