on develop help sign in
Merge commit 'bccbe42' into patchmapwithmove2
commit3c5d146b8a435b5178a06643c8c2928e58a7a0a8 authorRyan Trinkle <ryan.trinkle@gmail.com> dateWed 11 Sep 2019, 14:51 (7 years ago) parent8d7d7bebccbe42
11 files changed+68−74
ChangeLog.md+3−2 README.md+3−2 default.nix+1−1 reflex.cabal+6−6 src/Data/Functor/Misc.hs+2−3 src/Reflex/Class.hs+8−9 src/Reflex/Patch/DMapWithMove.hs+5−8 src/Reflex/Query/Base.hs+5−6 src/Reflex/Requester/Base.hs+2−3 src/Reflex/Spider/Internal.hs+32−33 src/Reflex/Workflow.hs+1−1
ChangeLog.md+3−2
@@ -1,9 +1,10 @@
11# Revision history for reflex
22
3−## Unreleased
3+## 0.6.2.0
44
5−* Fix `holdDyn` so that it is lazy in its event argument
65* Add `Reflex.Query.Base.mapQueryT`. See that module for documentation
6+* Stop using the now-deprecated `*Tag` classes (e.g., `ShowTag`).
7+* Fix `holdDyn` so that it is lazy in its event argument.
78
89## 0.6.1.0
910
README.md+3−2
@@ -1,4 +1,7 @@
11## [Reflex](https://reflex-frp.org/)
2+
3+[![Hackage](https://img.shields.io/hackage/v/reflex.svg)](http://hackage.haskell.org/package/reflex)
4+
25### Practical Functional Reactive Programming
36
47Reflex is a fully-deterministic, higher-order Functional Reactive Programming (FRP) interface and an engine that efficiently implements that interface.
@@ -14,8 +17,6 @@ A summary of Reflex functions is available in the [quick reference](Quickref.md)
1417
1518[/r/reflexfrp](https://www.reddit.com/r/reflexfrp)
1619
17−[hackage](https://hackage.haskell.org/package/reflex)
18−
1920[irc.freenode.net #reflex-frp](http://webchat.freenode.net?channels=%23reflex-frp&uio=d4)
2021
2122### Hacking
default.nix+1−1
@@ -11,7 +11,7 @@
1111}:
1212mkDerivation {
1313 pname = "reflex";
14− version = "0.6.1";
14+ version = "0.6.2.0";
1515 src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
1616 libraryHaskellDepends = [
1717 base bifunctors containers dependent-map dependent-sum
reflex.cabal+6−6
@@ -1,5 +1,5 @@
11Name: reflex
2−Version: 0.6.1
2+Version: 0.6.2.0
33Synopsis: Higher-order Functional Reactive Programming
44Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system
55License: BSD3
@@ -44,10 +44,10 @@ library
4444 base >= 4.9 && < 4.13,
4545 bifunctors >= 5.2 && < 5.6,
4646 comonad,
47− constraints-extras,
47+ constraints-extras >= 0.2,
4848 containers >= 0.5 && < 0.7,
4949 data-default >= 0.5 && < 0.8,
50− dependent-map >= 0.2.4 && < 0.4,
50+ dependent-map >= 0.3 && < 0.4,
5151 exception-transformers == 0.4.*,
5252 lens >= 4.7 && < 5,
5353 monad-control >= 1.0.1 && < 1.1,
@@ -135,8 +135,8 @@ library
135135 if flag(use-template-haskell)
136136 cpp-options: -DUSE_TEMPLATE_HASKELL
137137 build-depends:
138− dependent-sum >= 0.3 && < 0.7,
139− haskell-src-exts >= 1.16 && < 1.21,
138+ dependent-sum >= 0.6 && < 0.7,
139+ haskell-src-exts >= 1.16 && < 1.22,
140140 haskell-src-meta >= 0.6 && < 0.9,
141141 template-haskell >= 2.9 && < 2.15
142142 exposed-modules:
@@ -144,7 +144,7 @@ library
144144 other-extensions: TemplateHaskell
145145 else
146146 build-depends:
147− dependent-sum >= 0.4 && < 0.7
147+ dependent-sum == 0.6.*
148148
149149 if flag(fast-weak) && impl(ghcjs)
150150 cpp-options: -DGHCJS_FAST_WEAK
src/Data/Functor/Misc.hs+2−3
@@ -52,8 +52,7 @@ import Data.IntMap (IntMap)
5252import qualified Data.IntMap as IntMap
5353import Data.Map (Map)
5454import qualified Data.Map as Map
55−import Data.Some (Some)
56−import qualified Data.Some as Some
55+import Data.Some (Some(Some))
5756import Data.These
5857import Data.Typeable hiding (Refl)
5958
@@ -121,7 +120,7 @@ intMapWithFunctorToDMap = DMap.fromDistinctAscList . map (\(k, v) -> Const2 k :=
121120-- | Convert a 'DMap' to a regular 'Map' by forgetting the types associated with
122121-- the keys, using a function to remove the wrapping 'Functor'
123122weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v'
124−weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (Some.This k, f v)) . DMap.toAscList
123+weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (Some k, f v)) . DMap.toAscList
125124
126125--------------------------------------------------------------------------------
127126-- WrapArg
src/Reflex/Class.hs+8−9
@@ -193,8 +193,7 @@ import qualified Data.IntMap.Strict as IntMap
193193import Data.List.NonEmpty (NonEmpty (..))
194194import Data.Map (Map)
195195import Data.Semigroup (Semigroup, sconcat, stimes, (<>))
196−import Data.Some (Some)
197−import qualified Data.Some as Some
196+import Data.Some (Some(Some))
198197import Data.String
199198import Data.These
200199import Data.Type.Coercion
@@ -257,10 +256,10 @@ class ( MonadHold t (PushM t)
257256 -- least one input event is occurring, and will contain all of the input keys
258257 -- that are occurring simultaneously
259258 merge :: GCompare k => DMap k (Event t) -> Event t (DMap k Identity) --TODO: Generalize to get rid of DMap use --TODO: Provide a type-level guarantee that the result is not empty
260− -- | Efficiently fan-out an event to many destinations. This function should
261− -- be partially applied, and then the result applied repeatedly to create
262− -- child events
263− fan :: GCompare k => Event t (DMap k Identity) -> EventSelector t k --TODO: Can we help enforce the partial application discipline here? The combinator is worthless without it
259+ -- | Efficiently fan-out an event to many destinations. You should save the
260+ -- result in a @let@-binding, and then repeatedly 'select' on the result to
261+ -- create child events
262+ fan :: GCompare k => Event t (DMap k Identity) -> EventSelector t k
264263 -- | Create an 'Event' that will occur whenever the currently-selected input
265264 -- 'Event' occurs
266265 switch :: Behavior t (Event t a) -> Event t a
@@ -1155,9 +1154,9 @@ factorEvent
11551154 -> Event t (DSum k v)
11561155 -> m (Event t (v a), Event t (DSum k (Product v (Compose (Event t) v))))
11571156factorEvent k0 kv' = do
1158− key :: Behavior t (Some k) <- hold (Some.This k0) $ fmapCheap (\(k :=> _) -> Some.This k) kv'
1157+ key :: Behavior t (Some k) <- hold (Some k0) $ fmapCheap (\(k :=> _) -> Some k) kv'
11591158 let update = flip push kv' $ \(newKey :=> newVal) -> sample key >>= \case
1160− Some.This oldKey -> case newKey `geq` oldKey of
1159+ Some oldKey -> case newKey `geq` oldKey of
11611160 Just Refl -> return Nothing
11621161 Nothing -> do
11631162 newInner <- filterEventKey newKey kv'
@@ -1367,7 +1366,7 @@ mapAccumMaybeB
13671366 -> m (Behavior t a, Event t c)
13681367mapAccumMaybeB f = mapAccumMaybeMB $ \v o -> return $ f v o
13691368
1370−-- | LIke 'mapAccumMaybeB' except that the combining function is a 'PushM' action.
1369+-- | Like 'mapAccumMaybeB' except that the combining function is a 'PushM' action.
13711370{-# INLINE mapAccumMaybeMB #-}
13721371mapAccumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c)
13731372mapAccumMaybeMB f z e = do
src/Reflex/Patch/DMapWithMove.hs+5−8
@@ -22,7 +22,6 @@ import qualified Reflex.Patch.MapWithMove as MapWithMove
2222import Data.Constraint.Extras
2323import Data.Dependent.Map (DMap, DSum (..), GCompare (..))
2424import qualified Data.Dependent.Map as DMap
25−import Data.Dependent.Sum (EqTag (..))
2625import Data.Functor.Constant
2726import Data.Functor.Misc
2827import Data.Functor.Product
@@ -31,8 +30,7 @@ import Data.GADT.Show (GShow, gshow)
3130import qualified Data.Map as Map
3231import Data.Maybe
3332import Data.Semigroup (Semigroup (..), (<>))
34−import Data.Some (Some)
35−import qualified Data.Some as Some
33+import Data.Some (Some(Some))
3634import Data.These
3735
3836-- | Like 'PatchMapWithMove', but for 'DMap'. Each key carries a 'NodeInfo' which describes how it will be changed by the patch and connects move sources and
@@ -106,9 +104,8 @@ validationErrorsForPatchDMapWithMove m =
106104 unbalancedMove _ = Nothing
107105
108106-- |Test whether two @'PatchDMapWithMove' k v@ contain the same patch operations.
109−-- TODO: Get rid of EqTag constraint once dependent-map > 0.2.4.0, which drops this requirement, is released
110−instance (GEq k, Has' Eq k (NodeInfo k v), EqTag k (NodeInfo k v)) => Eq (PatchDMapWithMove k v) where
111− PatchDMapWithMove a == PatchDMapWithMove b = a == b
107+instance (GEq k, Has' Eq k (NodeInfo k v)) => Eq (PatchDMapWithMove k v) where
108+ PatchDMapWithMove a == PatchDMapWithMove b = a == b
112109
113110-- |Higher kinded 2-tuple, identical to @Data.Functor.Product@ from base ≥ 4.9
114111data Pair1 f g a = Pair1 (f a) (g a)
@@ -313,8 +310,8 @@ weakenPatchDMapWithMoveWith f (PatchDMapWithMove p) = PatchMapWithMove $ weakenD
313310 { MapWithMove._nodeInfo_from = case _nodeInfo_from ni of
314311 From_Insert v -> MapWithMove.From_Insert $ f v
315312 From_Delete -> MapWithMove.From_Delete
316− From_Move k -> MapWithMove.From_Move $ Some.This k
317− , MapWithMove._nodeInfo_to = Some.This <$> getComposeMaybe (_nodeInfo_to ni)
313+ From_Move k -> MapWithMove.From_Move $ Some k
314+ , MapWithMove._nodeInfo_to = Some <$> getComposeMaybe (_nodeInfo_to ni)
318315 }
319316
320317-- |"Weaken" a @'PatchDMapWithMove' (Const2 k a) v@ to a @'PatchMapWithMove' k v'@. Weaken is in scare quotes because the 'Const2' has already disabled any
src/Reflex/Query/Base.hs+5−6
@@ -39,8 +39,7 @@ import Data.Map (Map)
3939import qualified Data.Map as Map
4040import Data.Monoid ((<>))
4141import qualified Data.Semigroup as S
42−import Data.Some (Some)
43−import qualified Data.Some as Some
42+import Data.Some (Some(Some))
4443import Data.These
4544
4645import Reflex.Class
@@ -146,10 +145,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
146145 liftedResult' = fforCheap result' $ \(PatchDMap p) -> PatchDMap $
147146 mapKeyValuePairsMonotonic (\(k :=> ComposeMaybe mr) -> k :=> ComposeMaybe (fmap (getQueryTLoweredResultValue . getCompose) mr)) p
148147 liftedBs0 :: Map (Some k) [Behavior t q]
149− liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some.This k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
148+ liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
150149 liftedBs' :: Event t (PatchMap (Some k) [Behavior t q])
151150 liftedBs' = fforCheap result' $ \(PatchDMap p) -> PatchMap $
152− Map.fromDistinctAscList $ (\(k :=> ComposeMaybe mr) -> (Some.This k, fmap (getQueryTLoweredResultWritten . getCompose) mr)) <$> DMap.toList p
151+ Map.fromDistinctAscList $ (\(k :=> ComposeMaybe mr) -> (Some k, fmap (getQueryTLoweredResultWritten . getCompose) mr)) <$> DMap.toList p
153152 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
154153 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
155154 accumBehaviors :: forall m'. MonadHold t m'
@@ -190,10 +189,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
190189 let liftedResult0 = mapKeyValuePairsMonotonic (\(k :=> Compose r) -> k :=> getQueryTLoweredResultValue r) result0
191190 liftedResult' = fforCheap result' $ mapPatchDMapWithMove (getQueryTLoweredResultValue . getCompose)
192191 liftedBs0 :: Map (Some k) [Behavior t q]
193− liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some.This k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
192+ liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
194193 liftedBs' :: Event t (PatchMapWithMove (Some k) [Behavior t q])
195194 liftedBs' = fforCheap result' $ weakenPatchDMapWithMoveWith (getQueryTLoweredResultWritten . getCompose) {- \(PatchDMap p) -> PatchMapWithMove $
196− Map.fromDistinctAscList $ (\(k :=> mr) -> (Some.This k, fmap (fmap (getQueryTLoweredResultWritten . getCompose)) mr)) <$> DMap.toList p -}
195+ Map.fromDistinctAscList $ (\(k :=> mr) -> (Some k, fmap (fmap (getQueryTLoweredResultWritten . getCompose)) mr)) <$> DMap.toList p -}
197196 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
198197 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
199198 accumBehaviors' :: forall m'. MonadHold t m'
src/Reflex/Requester/Base.hs+2−3
@@ -66,8 +66,7 @@ import qualified Data.Map as Map
6666import Data.Monoid ((<>))
6767import Data.Proxy
6868import qualified Data.Semigroup as S
69−import Data.Some (Some)
70−import qualified Data.Some as Some
69+import Data.Some (Some(Some))
7170import Data.Type.Equality
7271import Data.Unique.Tag
7372
@@ -441,7 +440,7 @@ traverseDMapWithKeyWithAdjustRequesterTWith base mapPatch weakenPatchWith patchN
441440 pack = Entry
442441 f' :: forall a. k a -> Compose ((,) Int) v a -> m (Compose ((,) (Event t (IntMap (RequesterData request)))) v' a)
443442 f' k (Compose (n, v)) = do
444− (result, myRequests) <- runRequesterT (f k v) $ mapMaybeCheap (IntMap.lookup n) $ select responses (Const2 (Some.This k))
443+ (result, myRequests) <- runRequesterT (f k v) $ mapMaybeCheap (IntMap.lookup n) $ select responses (Const2 (Some k))
445444 return $ Compose (fmapCheap (IntMap.singleton n) myRequests, result)
446445 ndm' <- numberOccurrencesFrom 1 dm'
447446 (children0, children') <- base f' (DMap.map (\v -> Compose (0, v)) dm0) $ fmap (\(n, dm) -> mapPatch (\v -> Compose (n, v)) dm) ndm'
src/Reflex/Spider/Internal.hs+32−33
@@ -74,8 +74,7 @@ import Data.Tree (Forest, Tree (..), drawForest)
7474import Data.FastWeakBag (FastWeakBag)
7575import qualified Data.FastWeakBag as FastWeakBag
7676import Data.Reflection
77−import Data.Some (Some)
78−import qualified Data.Some as Some
77+import Data.Some (Some(Some))
7978import Data.Type.Coercion
8079import Data.WeakBag (WeakBag, WeakBagTicket, _weakBag_children)
8180import qualified Data.WeakBag as WeakBag
@@ -582,7 +581,7 @@ eventSubscribedFan !subscribed = EventSubscribed
582581 { eventSubscribedHeightRef = eventSubscribedHeightRef $ _eventSubscription_subscribed $ fanSubscribedParent subscribed
583582 , eventSubscribedRetained = toAny subscribed
584583#ifdef DEBUG_CYCLES
585− , eventSubscribedGetParents = return [Some.This $ _eventSubscription_subscribed $ fanSubscribedParent subscribed]
584+ , eventSubscribedGetParents = return [Some $ _eventSubscription_subscribed $ fanSubscribedParent subscribed]
586585 , eventSubscribedHasOwnHeightRef = False
587586 , eventSubscribedWhoCreated = whoCreatedIORef $ fanSubscribedCachedSubscribed subscribed
588587#endif
@@ -595,7 +594,7 @@ eventSubscribedSwitch !subscribed = EventSubscribed
595594#ifdef DEBUG_CYCLES
596595 , eventSubscribedGetParents = do
597596 s <- readIORef $ switchSubscribedCurrentParent subscribed
598− return [Some.This $ _eventSubscription_subscribed s]
597+ return [Some $ _eventSubscription_subscribed s]
599598 , eventSubscribedHasOwnHeightRef = True
600599 , eventSubscribedWhoCreated = whoCreatedIORef $ switchSubscribedCachedSubscribed subscribed
601600#endif
@@ -608,8 +607,8 @@ eventSubscribedCoincidence !subscribed = EventSubscribed
608607#ifdef DEBUG_CYCLES
609608 , eventSubscribedGetParents = do
610609 innerSubscription <- readIORef $ coincidenceSubscribedInnerParent subscribed
611− let outerParent = Some.This $ _eventSubscription_subscribed $ coincidenceSubscribedOuterParent subscribed
612− innerParents = maybeToList $ fmap Some.This innerSubscription
610+ let outerParent = Some $ _eventSubscription_subscribed $ coincidenceSubscribedOuterParent subscribed
611+ innerParents = maybeToList $ fmap Some innerSubscription
613612 return $ outerParent : innerParents
614613 , eventSubscribedHasOwnHeightRef = True
615614 , eventSubscribedWhoCreated = whoCreatedIORef $ coincidenceSubscribedCachedSubscribed subscribed
@@ -625,13 +624,13 @@ whoCreatedEventSubscribed = eventSubscribedWhoCreated
625624
626625walkInvalidHeightParents :: EventSubscribed x -> IO [Some (EventSubscribed x)]
627626walkInvalidHeightParents s0 = do
628− subscribers <- flip execStateT mempty $ ($ Some.This s0) $ fix $ \loop (Some.This s) -> do
627+ subscribers <- flip execStateT mempty $ ($ Some s0) $ fix $ \loop (Some s) -> do
629628 h <- liftIO $ readIORef $ eventSubscribedHeightRef s
630629 when (h == invalidHeight) $ do
631630 when (eventSubscribedHasOwnHeightRef s) $ liftIO $ writeIORef (eventSubscribedHeightRef s) $! invalidHeightBeingTraversed
632− modify (Some.This s :)
631+ modify (Some s :)
633632 mapM_ loop =<< liftIO (eventSubscribedGetParents s)
634− forM_ subscribers $ \(Some.This s) -> writeIORef (eventSubscribedHeightRef s) $! invalidHeight
633+ forM_ subscribers $ \(Some s) -> writeIORef (eventSubscribedHeightRef s) $! invalidHeight
635634 return subscribers
636635#endif
637636
@@ -659,7 +658,7 @@ behaviorPull !p = Behavior $ do
659658 val <- liftIO $ readIORef $ pullValue p
660659 case val of
661660 Just subscribed -> do
662− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (BehaviorSubscribedPull subscribed) :))
661+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedPull subscribed)) :))
663662 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (pullSubscribedInvalidators subscribed) (wi:))
664663 liftIO $ touch $ pullSubscribedOwnInvalidator subscribed
665664 return $ pullSubscribedValue subscribed
@@ -678,7 +677,7 @@ behaviorPull !p = Behavior $ do
678677 , pullSubscribedParents = parents
679678 }
680679 liftIO $ writeIORef (pullValue p) $ Just subscribed
681− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (BehaviorSubscribedPull subscribed) :))
680+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedPull subscribed)) :))
682681 return a
683682
684683behaviorDyn :: Patch p => Dyn x p -> Behavior x (PatchTarget p)
@@ -689,7 +688,7 @@ readHoldTracked :: Hold x p -> BehaviorM x (PatchTarget p)
689688readHoldTracked h = do
690689 result <- liftIO $ readIORef $ holdValue h
691690 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (holdInvalidators h) (wi:))
692− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (BehaviorSubscribedHold h) :))
691+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedHold h)) :))
693692 liftIO $ touch h -- Otherwise, if this gets inlined enough, the hold's parent reference may get collected
694693 return result
695694
@@ -782,9 +781,9 @@ data EventEnv x
782781 , eventEnvDynInits :: !(IORef [SomeDynInit x])
783782 , eventEnvMergeUpdates :: !(IORef [SomeMergeUpdate x])
784783 , eventEnvMergeInits :: !(IORef [SomeMergeInit x]) -- Needed for Subscribe
785− , eventEnvClears :: !(IORef [SomeClear]) -- Needed for Subscribe
786− , eventEnvIntClears :: !(IORef [SomeIntClear])
787− , eventEnvRootClears :: !(IORef [SomeRootClear])
784+ , eventEnvClears :: !(IORef [Some Clear]) -- Needed for Subscribe
785+ , eventEnvIntClears :: !(IORef [Some IntClear])
786+ , eventEnvRootClears :: !(IORef [Some RootClear])
788787 , eventEnvCurrentHeight :: !(IORef Height) -- Needed for Subscribe
789788 , eventEnvResetCoincidences :: !(IORef [SomeResetCoincidence x]) -- Needed for Subscribe
790789 , eventEnvDelayedMerges :: !(IORef (IntMap [EventM x ()]))
@@ -856,29 +855,29 @@ putCurrentHeight h = do
856855 heightRef <- asksEventEnv eventEnvCurrentHeight
857856 liftIO $ writeIORef heightRef $! h
858857
859−instance HasSpiderTimeline x => Defer SomeClear (EventM x) where
858+instance HasSpiderTimeline x => Defer (Some Clear) (EventM x) where
860859 {-# INLINE getDeferralQueue #-}
861860 getDeferralQueue = asksEventEnv eventEnvClears
862861
863862{-# INLINE scheduleClear #-}
864−scheduleClear :: Defer SomeClear m => IORef (Maybe a) -> m ()
865−scheduleClear r = defer $ SomeClear r
863+scheduleClear :: Defer (Some Clear) m => IORef (Maybe a) -> m ()
864+scheduleClear r = defer $ Some $ Clear r
866865
867−instance HasSpiderTimeline x => Defer SomeIntClear (EventM x) where
866+instance HasSpiderTimeline x => Defer (Some IntClear) (EventM x) where
868867 {-# INLINE getDeferralQueue #-}
869868 getDeferralQueue = asksEventEnv eventEnvIntClears
870869
871870{-# INLINE scheduleIntClear #-}
872−scheduleIntClear :: Defer SomeIntClear m => IORef (IntMap a) -> m ()
873−scheduleIntClear r = defer $ SomeIntClear r
871+scheduleIntClear :: Defer (Some IntClear) m => IORef (IntMap a) -> m ()
872+scheduleIntClear r = defer $ Some $ IntClear r
874873
875−instance HasSpiderTimeline x => Defer SomeRootClear (EventM x) where
874+instance HasSpiderTimeline x => Defer (Some RootClear) (EventM x) where
876875 {-# INLINE getDeferralQueue #-}
877876 getDeferralQueue = asksEventEnv eventEnvRootClears
878877
879878{-# INLINE scheduleRootClear #-}
880−scheduleRootClear :: Defer SomeRootClear m => IORef (DMap k Identity) -> m ()
881−scheduleRootClear r = defer $ SomeRootClear r
879+scheduleRootClear :: Defer (Some RootClear) m => IORef (DMap k Identity) -> m ()
880+scheduleRootClear r = defer $ Some $ RootClear r
882881
883882instance HasSpiderTimeline x => Defer (SomeResetCoincidence x) (EventM x) where
884883 {-# INLINE getDeferralQueue #-}
@@ -951,7 +950,7 @@ data BehaviorSubscribed x a
951950 = forall p. BehaviorSubscribedHold (Hold x p)
952951 | BehaviorSubscribedPull (PullSubscribed x a)
953952
954−data SomeBehaviorSubscribed x = forall a. SomeBehaviorSubscribed (BehaviorSubscribed x a)
953+newtype SomeBehaviorSubscribed x = SomeBehaviorSubscribed (Some (BehaviorSubscribed x))
955954
956955--type role PullSubscribed representational
957956data PullSubscribed x a
@@ -1259,11 +1258,11 @@ scheduleMerge' initialHeight heightRef a = scheduleMerge initialHeight $ do
12591258 GT -> scheduleMerge' height heightRef a -- The height has been increased (by a coincidence event; TODO: is this the only way?)
12601259 EQ -> a
12611260
1262−data SomeClear = forall a. SomeClear {-# UNPACK #-} !(IORef (Maybe a))
1261+newtype Clear a = Clear (IORef (Maybe a))
12631262
1264−data SomeIntClear = forall a. SomeIntClear {-# UNPACK #-} !(IORef (IntMap a))
1263+newtype IntClear a = IntClear (IORef (IntMap a))
12651264
1266−data SomeRootClear = forall k. SomeRootClear {-# UNPACK #-} !(IORef (DMap k Identity))
1265+newtype RootClear k = RootClear (IORef (DMap k Identity))
12671266
12681267data SomeAssignment x = forall a. SomeAssignment {-# UNPACK #-} !(IORef a) {-# UNPACK #-} !(IORef [Weak (Invalidator x)]) a
12691268
@@ -1853,7 +1852,7 @@ mergeSubscriber m getKey = Subscriber
18531852 else liftIO $ do
18541853#ifdef DEBUG_CYCLES
18551854 nodesInvolvedInCycle <- walkInvalidHeightParents $ eventSubscribedMerge subscribed
1856− stacks <- forM nodesInvolvedInCycle $ \(Some.This es) -> whoCreatedEventSubscribed es
1855+ stacks <- forM nodesInvolvedInCycle $ \(Some es) -> whoCreatedEventSubscribed es
18571856 let cycleInfo = ":\n" <> drawForest (listsToForest stacks)
18581857#else
18591858 let cycleInfo = ""
@@ -2096,11 +2095,11 @@ runFrame a = SpiderHost $ do
20962095 return result
20972096 result <- runEventM go
20982097 toClear <- readIORef $ eventEnvClears env
2099− forM_ toClear $ \(SomeClear ref) -> {-# SCC "clear" #-} writeIORef ref Nothing
2098+ forM_ toClear $ \(Some (Clear ref)) -> {-# SCC "clear" #-} writeIORef ref Nothing
21002099 toClearInt <- readIORef $ eventEnvIntClears env
2101− forM_ toClearInt $ \(SomeIntClear ref) -> {-# SCC "intClear" #-} writeIORef ref $! IntMap.empty
2100+ forM_ toClearInt $ \(Some (IntClear ref)) -> {-# SCC "intClear" #-} writeIORef ref $! IntMap.empty
21022101 toClearRoot <- readIORef $ eventEnvRootClears env
2103− forM_ toClearRoot $ \(SomeRootClear ref) -> {-# SCC "rootClear" #-} writeIORef ref $! DMap.empty
2102+ forM_ toClearRoot $ \(Some (RootClear ref)) -> {-# SCC "rootClear" #-} writeIORef ref $! DMap.empty
21042103 toAssign <- readIORef $ eventEnvAssignments env
21052104 toReconnectRef <- newIORef []
21062105 coincidenceInfos <- readIORef $ eventEnvResetCoincidences env
@@ -2460,7 +2459,7 @@ unsafeNewSpiderTimelineEnv = do
24602459
24612460-- | Create a new SpiderTimelineEnv
24622461newSpiderTimeline :: IO (Some SpiderTimelineEnv)
2463−newSpiderTimeline = withSpiderTimeline (pure . Some.This)
2462+newSpiderTimeline = withSpiderTimeline (pure . Some)
24642463
24652464data LocalSpiderTimeline x s
24662465
src/Reflex/Workflow.hs+1−1
@@ -41,7 +41,7 @@ workflowView w0 = do
4141 eReplace <- fmap switch $ hold never $ fmap snd eResult
4242 return $ fmap fst eResult
4343
44−-- | Map a function over a 'Workflow', possibly changing the resturn type.
44+-- | Map a function over a 'Workflow', possibly changing the return type.
4545mapWorkflow :: (Reflex t, Functor m) => (a -> b) -> Workflow t m a -> Workflow t m b
4646mapWorkflow f (Workflow x) = Workflow (fmap (f *** fmap (mapWorkflow f)) x)
4747