on develop help sign in
Merge branch 'develop' into canhazmerge
e5d5946Oliver Batchelor
ChangeLog.md+12−5
@@ -2,11 +2,18 @@
2
2
3## Unreleased
3## Unreleased
4
4
5−* Fix `holdDyn` so that it is lazy in its event argument
5+* Generalize merging functions:
6−* Generalize `merge` to `mergeG`, `mergeIncremental` to
6+ `merge` to `mergeG`,
7− `mergeIncrementalG`, and `mergeIncrementalWithMove`
7+ `mergeIncremental` to `mergeIncrementalG`,
8+ `distributeDMapOverDynPure` to `distributeDMapOverDynPureG`,
8− to `mergeIncrementalWithMoveG`. These produce `DMap`s
9+ `mergeIncrementalWithMove` to `mergeIncrementalWithMoveG`.
10+
11+## 0.6.2.0
12+
13+* Fix `holdDyn` so that it is lazy in its event argument
9− whose values needn't be `Identity`.
14+ These produce `DMap`s whose values needn't be `Identity`.
15+* Stop using the now-deprecated `*Tag` classes (e.g., `ShowTag`).
16+* Fix `holdDyn` so that it is lazy in its event argument.
10
17
11## 0.6.1.0
18## 0.6.1.0
12
19
default.nix+1−1
@@ -11,7 +11,7 @@
11}:
11}:
12mkDerivation {
12mkDerivation {
13 pname = "reflex";
13 pname = "reflex";
14− version = "0.6.1";
14+ version = "0.6.2.0";
15 src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
15 src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
16 libraryHaskellDepends = [
16 libraryHaskellDepends = [
17 base bifunctors containers dependent-map dependent-sum
17 base bifunctors containers dependent-map dependent-sum
reflex.cabal+5−4
@@ -1,5 +1,5 @@
1Name: reflex
1Name: reflex
2−Version: 0.6.1
2+Version: 0.6.2.0
3Synopsis: Higher-order Functional Reactive Programming
3Synopsis: Higher-order Functional Reactive Programming
4Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system
4Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system
5License: BSD3
5License: BSD3
@@ -44,9 +44,10 @@ library
44 base >= 4.9 && < 4.13,
44 base >= 4.9 && < 4.13,
45 bifunctors >= 5.2 && < 5.6,
45 bifunctors >= 5.2 && < 5.6,
46 comonad,
46 comonad,
47+ constraints-extras >= 0.2,
47 containers >= 0.5 && < 0.7,
48 containers >= 0.5 && < 0.7,
48 data-default >= 0.5 && < 0.8,
49 data-default >= 0.5 && < 0.8,
49− dependent-map >= 0.2.4 && < 0.3,
50+ dependent-map >= 0.3 && < 0.4,
50 exception-transformers == 0.4.*,
51 exception-transformers == 0.4.*,
51 profunctors,
52 profunctors,
52 lens >= 4.7 && < 5,
53 lens >= 4.7 && < 5,
@@ -134,7 +135,7 @@ library
134 if flag(use-template-haskell)
135 if flag(use-template-haskell)
135 cpp-options: -DUSE_TEMPLATE_HASKELL
136 cpp-options: -DUSE_TEMPLATE_HASKELL
136 build-depends:
137 build-depends:
137− dependent-sum >= 0.3 && < 0.5,
138+ dependent-sum >= 0.6 && < 0.7,
138 haskell-src-exts >= 1.16 && < 1.22,
139 haskell-src-exts >= 1.16 && < 1.22,
139 haskell-src-meta >= 0.6 && < 0.9,
140 haskell-src-meta >= 0.6 && < 0.9,
140 template-haskell >= 2.9 && < 2.15
141 template-haskell >= 2.9 && < 2.15
@@ -143,7 +144,7 @@ library
143 other-extensions: TemplateHaskell
144 other-extensions: TemplateHaskell
144 else
145 else
145 build-depends:
146 build-depends:
146− dependent-sum == 0.4.*
147+ dependent-sum == 0.6.*
147
148
148 if flag(fast-weak) && impl(ghcjs)
149 if flag(fast-weak) && impl(ghcjs)
149 cpp-options: -DGHCJS_FAST_WEAK
150 cpp-options: -DGHCJS_FAST_WEAK
src/Data/Functor/Misc.hs+2−11
@@ -52,8 +52,7 @@ import Data.IntMap (IntMap)
52import qualified Data.IntMap as IntMap
52import qualified Data.IntMap as IntMap
53import Data.Map (Map)
53import Data.Map (Map)
54import qualified Data.Map as Map
54import qualified Data.Map as Map
55−import Data.Some (Some)
55+import Data.Some (Some(Some))
56−import qualified Data.Some as Some
57import Data.These
56import Data.These
58import Data.Typeable hiding (Refl)
57import Data.Typeable hiding (Refl)
59
58
@@ -79,9 +78,6 @@ deriving instance Read k => Read (Const2 k v v)
79instance Show k => GShow (Const2 k v) where
78instance Show k => GShow (Const2 k v) where
80 gshowsPrec n x@(Const2 _) = showsPrec n x
79 gshowsPrec n x@(Const2 _) = showsPrec n x
81
80
82−instance (Show k, Show (f v)) => ShowTag (Const2 k v) f where
83− showTaggedPrec (Const2 _) = showsPrec
84−
85instance Eq k => GEq (Const2 k v) where
81instance Eq k => GEq (Const2 k v) where
86 geq (Const2 a) (Const2 b) =
82 geq (Const2 a) (Const2 b) =
87 if a == b
83 if a == b
@@ -124,7 +120,7 @@ intMapWithFunctorToDMap = DMap.fromDistinctAscList . map (\(k, v) -> Const2 k :=
124-- | Convert a 'DMap' to a regular 'Map' by forgetting the types associated with
120-- | Convert a 'DMap' to a regular 'Map' by forgetting the types associated with
125-- the keys, using a function to remove the wrapping 'Functor'
121-- the keys, using a function to remove the wrapping 'Functor'
126weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v'
122weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v'
127−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
128
124
129--------------------------------------------------------------------------------
125--------------------------------------------------------------------------------
130-- WrapArg
126-- WrapArg
@@ -214,11 +210,6 @@ instance GShow (EitherTag l r) where
214 LeftTag -> showString "LeftTag"
210 LeftTag -> showString "LeftTag"
215 RightTag -> showString "RightTag"
211 RightTag -> showString "RightTag"
216
212
217−instance (Show l, Show r) => ShowTag (EitherTag l r) Identity where
218− showTaggedPrec t n (Identity a) = case t of
219− LeftTag -> showsPrec n a
220− RightTag -> showsPrec n a
221−
222-- | Convert 'Either' to a 'DSum'. Inverse of 'dsumToEither'.
213-- | Convert 'Either' to a 'DSum'. Inverse of 'dsumToEither'.
223eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity
214eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity
224eitherToDSum = \case
215eitherToDSum = \case
src/Reflex/Class.hs+3−4
@@ -198,8 +198,7 @@ import qualified Data.IntMap.Strict as IntMap
198import Data.List.NonEmpty (NonEmpty (..))
198import Data.List.NonEmpty (NonEmpty (..))
199import Data.Map (Map)
199import Data.Map (Map)
200import Data.Semigroup (Semigroup, sconcat, stimes, (<>))
200import Data.Semigroup (Semigroup, sconcat, stimes, (<>))
201−import Data.Some (Some)
201+import Data.Some (Some(Some))
202−import qualified Data.Some as Some
203import Data.String
202import Data.String
204import Data.These
203import Data.These
205import Data.Type.Coercion
204import Data.Type.Coercion
@@ -1176,9 +1175,9 @@ factorEvent
1176 -> Event t (DSum k v)
1175 -> Event t (DSum k v)
1177 -> m (Event t (v a), Event t (DSum k (Product v (Compose (Event t) v))))
1176 -> m (Event t (v a), Event t (DSum k (Product v (Compose (Event t) v))))
1178factorEvent k0 kv' = do
1177factorEvent k0 kv' = do
1179− key :: Behavior t (Some k) <- hold (Some.This k0) $ fmapCheap (\(k :=> _) -> Some.This k) kv'
1178+ key :: Behavior t (Some k) <- hold (Some k0) $ fmapCheap (\(k :=> _) -> Some k) kv'
1180 let update = flip push kv' $ \(newKey :=> newVal) -> sample key >>= \case
1179 let update = flip push kv' $ \(newKey :=> newVal) -> sample key >>= \case
1181− Some.This oldKey -> case newKey `geq` oldKey of
1180+ Some oldKey -> case newKey `geq` oldKey of
1182 Just Refl -> return Nothing
1181 Just Refl -> return Nothing
1183 Nothing -> do
1182 Nothing -> do
1184 newInner <- filterEventKey newKey kv'
1183 newInner <- filterEventKey newKey kv'
src/Reflex/Patch/DMapWithMove.hs+6−7
@@ -19,9 +19,9 @@ import Reflex.Patch.Class
19import Reflex.Patch.MapWithMove (PatchMapWithMove (..))
19import Reflex.Patch.MapWithMove (PatchMapWithMove (..))
20import qualified Reflex.Patch.MapWithMove as MapWithMove
20import qualified Reflex.Patch.MapWithMove as MapWithMove
21
21
22+import Data.Constraint.Extras
22import Data.Dependent.Map (DMap, DSum (..), GCompare (..))
23import Data.Dependent.Map (DMap, DSum (..), GCompare (..))
23import qualified Data.Dependent.Map as DMap
24import qualified Data.Dependent.Map as DMap
24−import Data.Dependent.Sum (EqTag (..))
25import Data.Functor.Constant
25import Data.Functor.Constant
26import Data.Functor.Misc
26import Data.Functor.Misc
27import Data.Functor.Product
27import Data.Functor.Product
@@ -30,8 +30,7 @@ import Data.GADT.Show (GShow, gshow)
30import qualified Data.Map as Map
30import qualified Data.Map as Map
31import Data.Maybe
31import Data.Maybe
32import Data.Semigroup (Semigroup (..), (<>))
32import Data.Semigroup (Semigroup (..), (<>))
33−import Data.Some (Some)
33+import Data.Some (Some(Some))
34−import qualified Data.Some as Some
35import Data.These
34import Data.These
36
35
37-- | 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
36-- | 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
@@ -105,8 +104,8 @@ validationErrorsForPatchDMapWithMove m =
105 unbalancedMove _ = Nothing
104 unbalancedMove _ = Nothing
106
105
107-- |Test whether two @'PatchDMapWithMove' k v@ contain the same patch operations.
106-- |Test whether two @'PatchDMapWithMove' k v@ contain the same patch operations.
108−instance EqTag k (NodeInfo k v) => Eq (PatchDMapWithMove k v) where
107+instance (GEq k, Has' Eq k (NodeInfo k v)) => Eq (PatchDMapWithMove k v) where
109− PatchDMapWithMove a == PatchDMapWithMove b = a == b
108+ PatchDMapWithMove a == PatchDMapWithMove b = a == b
110
109
111-- |Higher kinded 2-tuple, identical to @Data.Functor.Product@ from base ≥ 4.9
110-- |Higher kinded 2-tuple, identical to @Data.Functor.Product@ from base ≥ 4.9
112data Pair1 f g a = Pair1 (f a) (g a)
111data Pair1 f g a = Pair1 (f a) (g a)
@@ -311,8 +310,8 @@ weakenPatchDMapWithMoveWith f (PatchDMapWithMove p) = PatchMapWithMove $ weakenD
311 { MapWithMove._nodeInfo_from = case _nodeInfo_from ni of
310 { MapWithMove._nodeInfo_from = case _nodeInfo_from ni of
312 From_Insert v -> MapWithMove.From_Insert $ f v
311 From_Insert v -> MapWithMove.From_Insert $ f v
313 From_Delete -> MapWithMove.From_Delete
312 From_Delete -> MapWithMove.From_Delete
314− From_Move k -> MapWithMove.From_Move $ Some.This k
313+ From_Move k -> MapWithMove.From_Move $ Some k
315− , MapWithMove._nodeInfo_to = Some.This <$> getComposeMaybe (_nodeInfo_to ni)
314+ , MapWithMove._nodeInfo_to = Some <$> getComposeMaybe (_nodeInfo_to ni)
316 }
315 }
317
316
318-- |"Weaken" a @'PatchDMapWithMove' (Const2 k a) v@ to a @'PatchMapWithMove' k v'@. Weaken is in scare quotes because the 'Const2' has already disabled any
317-- |"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
@@ -38,8 +38,7 @@ import Data.Map (Map)
38import qualified Data.Map as Map
38import qualified Data.Map as Map
39import Data.Monoid ((<>))
39import Data.Monoid ((<>))
40import qualified Data.Semigroup as S
40import qualified Data.Semigroup as S
41−import Data.Some (Some)
41+import Data.Some (Some(Some))
42−import qualified Data.Some as Some
43import Data.These
42import Data.These
44
43
45import Reflex.Class
44import Reflex.Class
@@ -145,10 +144,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
145 liftedResult' = fforCheap result' $ \(PatchDMap p) -> PatchDMap $
144 liftedResult' = fforCheap result' $ \(PatchDMap p) -> PatchDMap $
146 mapKeyValuePairsMonotonic (\(k :=> ComposeMaybe mr) -> k :=> ComposeMaybe (fmap (getQueryTLoweredResultValue . getCompose) mr)) p
145 mapKeyValuePairsMonotonic (\(k :=> ComposeMaybe mr) -> k :=> ComposeMaybe (fmap (getQueryTLoweredResultValue . getCompose) mr)) p
147 liftedBs0 :: Map (Some k) [Behavior t q]
146 liftedBs0 :: Map (Some k) [Behavior t q]
148− liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some.This k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
147+ liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
149 liftedBs' :: Event t (PatchMap (Some k) [Behavior t q])
148 liftedBs' :: Event t (PatchMap (Some k) [Behavior t q])
150 liftedBs' = fforCheap result' $ \(PatchDMap p) -> PatchMap $
149 liftedBs' = fforCheap result' $ \(PatchDMap p) -> PatchMap $
151− Map.fromDistinctAscList $ (\(k :=> ComposeMaybe mr) -> (Some.This k, fmap (getQueryTLoweredResultWritten . getCompose) mr)) <$> DMap.toList p
150+ Map.fromDistinctAscList $ (\(k :=> ComposeMaybe mr) -> (Some k, fmap (getQueryTLoweredResultWritten . getCompose) mr)) <$> DMap.toList p
152 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
151 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
153 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
152 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
154 accumBehaviors :: forall m'. MonadHold t m'
153 accumBehaviors :: forall m'. MonadHold t m'
@@ -189,10 +188,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
189 let liftedResult0 = mapKeyValuePairsMonotonic (\(k :=> Compose r) -> k :=> getQueryTLoweredResultValue r) result0
188 let liftedResult0 = mapKeyValuePairsMonotonic (\(k :=> Compose r) -> k :=> getQueryTLoweredResultValue r) result0
190 liftedResult' = fforCheap result' $ mapPatchDMapWithMove (getQueryTLoweredResultValue . getCompose)
189 liftedResult' = fforCheap result' $ mapPatchDMapWithMove (getQueryTLoweredResultValue . getCompose)
191 liftedBs0 :: Map (Some k) [Behavior t q]
190 liftedBs0 :: Map (Some k) [Behavior t q]
192− liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some.This k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
191+ liftedBs0 = Map.fromDistinctAscList $ (\(k :=> Compose r) -> (Some k, getQueryTLoweredResultWritten r)) <$> DMap.toList result0
193 liftedBs' :: Event t (PatchMapWithMove (Some k) [Behavior t q])
192 liftedBs' :: Event t (PatchMapWithMove (Some k) [Behavior t q])
194 liftedBs' = fforCheap result' $ weakenPatchDMapWithMoveWith (getQueryTLoweredResultWritten . getCompose) {- \(PatchDMap p) -> PatchMapWithMove $
193 liftedBs' = fforCheap result' $ weakenPatchDMapWithMoveWith (getQueryTLoweredResultWritten . getCompose) {- \(PatchDMap p) -> PatchMapWithMove $
195− Map.fromDistinctAscList $ (\(k :=> mr) -> (Some.This k, fmap (fmap (getQueryTLoweredResultWritten . getCompose)) mr)) <$> DMap.toList p -}
194+ Map.fromDistinctAscList $ (\(k :=> mr) -> (Some k, fmap (fmap (getQueryTLoweredResultWritten . getCompose)) mr)) <$> DMap.toList p -}
196 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
195 sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
197 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
196 sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
198 accumBehaviors' :: forall m'. MonadHold t m'
197 accumBehaviors' :: forall m'. MonadHold t m'
src/Reflex/Requester/Base.hs+2−3
@@ -66,8 +66,7 @@ import qualified Data.Map as Map
66import Data.Monoid ((<>))
66import Data.Monoid ((<>))
67import Data.Proxy
67import Data.Proxy
68import qualified Data.Semigroup as S
68import qualified Data.Semigroup as S
69−import Data.Some (Some)
69+import Data.Some (Some(Some))
70−import qualified Data.Some as Some
71import Data.Type.Equality
70import Data.Type.Equality
72import Data.Unique.Tag
71import Data.Unique.Tag
73
72
@@ -441,7 +440,7 @@ traverseDMapWithKeyWithAdjustRequesterTWith base mapPatch weakenPatchWith patchN
441 pack = Entry
440 pack = Entry
442 f' :: forall a. k a -> Compose ((,) Int) v a -> m (Compose ((,) (Event t (IntMap (RequesterData request)))) v' a)
441 f' :: forall a. k a -> Compose ((,) Int) v a -> m (Compose ((,) (Event t (IntMap (RequesterData request)))) v' a)
443 f' k (Compose (n, v)) = do
442 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))
445 return $ Compose (fmapCheap (IntMap.singleton n) myRequests, result)
444 return $ Compose (fmapCheap (IntMap.singleton n) myRequests, result)
446 ndm' <- numberOccurrencesFrom 1 dm'
445 ndm' <- numberOccurrencesFrom 1 dm'
447 (children0, children') <- base f' (DMap.map (\v -> Compose (0, v)) dm0) $ fmap (\(n, dm) -> mapPatch (\v -> Compose (n, v)) dm) ndm'
446 (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+19−20
@@ -78,8 +78,7 @@ import Data.Tree (Forest, Tree (..), drawForest)
78import Data.FastWeakBag (FastWeakBag)
78import Data.FastWeakBag (FastWeakBag)
79import qualified Data.FastWeakBag as FastWeakBag
79import qualified Data.FastWeakBag as FastWeakBag
80import Data.Reflection
80import Data.Reflection
81−import Data.Some (Some)
81+import Data.Some (Some(Some))
82−import qualified Data.Some as Some
83import Data.Type.Coercion
82import Data.Type.Coercion
84import Data.Profunctor.Unsafe ((#.), (.#))
83import Data.Profunctor.Unsafe ((#.), (.#))
85import Data.WeakBag (WeakBag, WeakBagTicket, _weakBag_children)
84import Data.WeakBag (WeakBag, WeakBagTicket, _weakBag_children)
@@ -587,7 +586,7 @@ eventSubscribedFan !subscribed = EventSubscribed
587 { eventSubscribedHeightRef = eventSubscribedHeightRef $ _eventSubscription_subscribed $ fanSubscribedParent subscribed
586 { eventSubscribedHeightRef = eventSubscribedHeightRef $ _eventSubscription_subscribed $ fanSubscribedParent subscribed
588 , eventSubscribedRetained = toAny subscribed
587 , eventSubscribedRetained = toAny subscribed
589#ifdef DEBUG_CYCLES
588#ifdef DEBUG_CYCLES
590− , eventSubscribedGetParents = return [Some.This $ _eventSubscription_subscribed $ fanSubscribedParent subscribed]
589+ , eventSubscribedGetParents = return [Some $ _eventSubscription_subscribed $ fanSubscribedParent subscribed]
591 , eventSubscribedHasOwnHeightRef = False
590 , eventSubscribedHasOwnHeightRef = False
592 , eventSubscribedWhoCreated = whoCreatedIORef $ fanSubscribedCachedSubscribed subscribed
591 , eventSubscribedWhoCreated = whoCreatedIORef $ fanSubscribedCachedSubscribed subscribed
593#endif
592#endif
@@ -600,7 +599,7 @@ eventSubscribedSwitch !subscribed = EventSubscribed
600#ifdef DEBUG_CYCLES
599#ifdef DEBUG_CYCLES
601 , eventSubscribedGetParents = do
600 , eventSubscribedGetParents = do
602 s <- readIORef $ switchSubscribedCurrentParent subscribed
601 s <- readIORef $ switchSubscribedCurrentParent subscribed
603− return [Some.This $ _eventSubscription_subscribed s]
602+ return [Some $ _eventSubscription_subscribed s]
604 , eventSubscribedHasOwnHeightRef = True
603 , eventSubscribedHasOwnHeightRef = True
605 , eventSubscribedWhoCreated = whoCreatedIORef $ switchSubscribedCachedSubscribed subscribed
604 , eventSubscribedWhoCreated = whoCreatedIORef $ switchSubscribedCachedSubscribed subscribed
606#endif
605#endif
@@ -613,8 +612,8 @@ eventSubscribedCoincidence !subscribed = EventSubscribed
613#ifdef DEBUG_CYCLES
612#ifdef DEBUG_CYCLES
614 , eventSubscribedGetParents = do
613 , eventSubscribedGetParents = do
615 innerSubscription <- readIORef $ coincidenceSubscribedInnerParent subscribed
614 innerSubscription <- readIORef $ coincidenceSubscribedInnerParent subscribed
616− let outerParent = Some.This $ _eventSubscription_subscribed $ coincidenceSubscribedOuterParent subscribed
615+ let outerParent = Some $ _eventSubscription_subscribed $ coincidenceSubscribedOuterParent subscribed
617− innerParents = maybeToList $ fmap Some.This innerSubscription
616+ innerParents = maybeToList $ fmap Some innerSubscription
618 return $ outerParent : innerParents
617 return $ outerParent : innerParents
619 , eventSubscribedHasOwnHeightRef = True
618 , eventSubscribedHasOwnHeightRef = True
620 , eventSubscribedWhoCreated = whoCreatedIORef $ coincidenceSubscribedCachedSubscribed subscribed
619 , eventSubscribedWhoCreated = whoCreatedIORef $ coincidenceSubscribedCachedSubscribed subscribed
@@ -630,13 +629,13 @@ whoCreatedEventSubscribed = eventSubscribedWhoCreated
630
629
631walkInvalidHeightParents :: EventSubscribed x -> IO [Some (EventSubscribed x)]
630walkInvalidHeightParents :: EventSubscribed x -> IO [Some (EventSubscribed x)]
632walkInvalidHeightParents s0 = do
631walkInvalidHeightParents s0 = do
633− subscribers <- flip execStateT mempty $ ($ Some.This s0) $ fix $ \loop (Some.This s) -> do
632+ subscribers <- flip execStateT mempty $ ($ Some s0) $ fix $ \loop (Some s) -> do
634 h <- liftIO $ readIORef $ eventSubscribedHeightRef s
633 h <- liftIO $ readIORef $ eventSubscribedHeightRef s
635 when (h == invalidHeight) $ do
634 when (h == invalidHeight) $ do
636 when (eventSubscribedHasOwnHeightRef s) $ liftIO $ writeIORef (eventSubscribedHeightRef s) $! invalidHeightBeingTraversed
635 when (eventSubscribedHasOwnHeightRef s) $ liftIO $ writeIORef (eventSubscribedHeightRef s) $! invalidHeightBeingTraversed
637− modify (Some.This s :)
636+ modify (Some s :)
638 mapM_ loop =<< liftIO (eventSubscribedGetParents s)
637 mapM_ loop =<< liftIO (eventSubscribedGetParents s)
639− forM_ subscribers $ \(Some.This s) -> writeIORef (eventSubscribedHeightRef s) $! invalidHeight
638+ forM_ subscribers $ \(Some s) -> writeIORef (eventSubscribedHeightRef s) $! invalidHeight
640 return subscribers
639 return subscribers
641#endif
640#endif
642
641
@@ -664,7 +663,7 @@ behaviorPull !p = Behavior $ do
664 val <- liftIO $ readIORef $ pullValue p
663 val <- liftIO $ readIORef $ pullValue p
665 case val of
664 case val of
666 Just subscribed -> do
665 Just subscribed -> do
667− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some.This (BehaviorSubscribedPull subscribed)) :))
666+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedPull subscribed)) :))
668 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (pullSubscribedInvalidators subscribed) (wi:))
667 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (pullSubscribedInvalidators subscribed) (wi:))
669 liftIO $ touch $ pullSubscribedOwnInvalidator subscribed
668 liftIO $ touch $ pullSubscribedOwnInvalidator subscribed
670 return $ pullSubscribedValue subscribed
669 return $ pullSubscribedValue subscribed
@@ -683,7 +682,7 @@ behaviorPull !p = Behavior $ do
683 , pullSubscribedParents = parents
682 , pullSubscribedParents = parents
684 }
683 }
685 liftIO $ writeIORef (pullValue p) $ Just subscribed
684 liftIO $ writeIORef (pullValue p) $ Just subscribed
686− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some.This (BehaviorSubscribedPull subscribed)) :))
685+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedPull subscribed)) :))
687 return a
686 return a
688
687
689behaviorDyn :: Patch p => Dyn x p -> Behavior x (PatchTarget p)
688behaviorDyn :: Patch p => Dyn x p -> Behavior x (PatchTarget p)
@@ -694,7 +693,7 @@ readHoldTracked :: Hold x p -> BehaviorM x (PatchTarget p)
694readHoldTracked h = do
693readHoldTracked h = do
695 result <- liftIO $ readIORef $ holdValue h
694 result <- liftIO $ readIORef $ holdValue h
696 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (holdInvalidators h) (wi:))
695 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (holdInvalidators h) (wi:))
697− askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some.This (BehaviorSubscribedHold h)) :))
696+ askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedHold h)) :))
698 liftIO $ touch h -- Otherwise, if this gets inlined enough, the hold's parent reference may get collected
697 liftIO $ touch h -- Otherwise, if this gets inlined enough, the hold's parent reference may get collected
699 return result
698 return result
700
699
@@ -867,7 +866,7 @@ instance HasSpiderTimeline x => Defer (Some Clear) (EventM x) where
867
866
868{-# INLINE scheduleClear #-}
867{-# INLINE scheduleClear #-}
869scheduleClear :: Defer (Some Clear) m => IORef (Maybe a) -> m ()
868scheduleClear :: Defer (Some Clear) m => IORef (Maybe a) -> m ()
870−scheduleClear r = defer $ Some.This $ Clear r
869+scheduleClear r = defer $ Some $ Clear r
871
870
872instance HasSpiderTimeline x => Defer (Some IntClear) (EventM x) where
871instance HasSpiderTimeline x => Defer (Some IntClear) (EventM x) where
873 {-# INLINE getDeferralQueue #-}
872 {-# INLINE getDeferralQueue #-}
@@ -875,7 +874,7 @@ instance HasSpiderTimeline x => Defer (Some IntClear) (EventM x) where
875
874
876{-# INLINE scheduleIntClear #-}
875{-# INLINE scheduleIntClear #-}
877scheduleIntClear :: Defer (Some IntClear) m => IORef (IntMap a) -> m ()
876scheduleIntClear :: Defer (Some IntClear) m => IORef (IntMap a) -> m ()
878−scheduleIntClear r = defer $ Some.This $ IntClear r
877+scheduleIntClear r = defer $ Some $ IntClear r
879
878
880instance HasSpiderTimeline x => Defer (Some RootClear) (EventM x) where
879instance HasSpiderTimeline x => Defer (Some RootClear) (EventM x) where
881 {-# INLINE getDeferralQueue #-}
880 {-# INLINE getDeferralQueue #-}
@@ -883,7 +882,7 @@ instance HasSpiderTimeline x => Defer (Some RootClear) (EventM x) where
883
882
884{-# INLINE scheduleRootClear #-}
883{-# INLINE scheduleRootClear #-}
885scheduleRootClear :: Defer (Some RootClear) m => IORef (DMap k Identity) -> m ()
884scheduleRootClear :: Defer (Some RootClear) m => IORef (DMap k Identity) -> m ()
886−scheduleRootClear r = defer $ Some.This $ RootClear r
885+scheduleRootClear r = defer $ Some $ RootClear r
887
886
888instance HasSpiderTimeline x => Defer (SomeResetCoincidence x) (EventM x) where
887instance HasSpiderTimeline x => Defer (SomeResetCoincidence x) (EventM x) where
889 {-# INLINE getDeferralQueue #-}
888 {-# INLINE getDeferralQueue #-}
@@ -1872,7 +1871,7 @@ mergeSubscriber m getKey = Subscriber
1872 else liftIO $ do
1871 else liftIO $ do
1873#ifdef DEBUG_CYCLES
1872#ifdef DEBUG_CYCLES
1874 nodesInvolvedInCycle <- walkInvalidHeightParents $ eventSubscribedMerge subscribed
1873 nodesInvolvedInCycle <- walkInvalidHeightParents $ eventSubscribedMerge subscribed
1875− stacks <- forM nodesInvolvedInCycle $ \(Some.This es) -> whoCreatedEventSubscribed es
1874+ stacks <- forM nodesInvolvedInCycle $ \(Some es) -> whoCreatedEventSubscribed es
1876 let cycleInfo = ":\n" <> drawForest (listsToForest stacks)
1875 let cycleInfo = ":\n" <> drawForest (listsToForest stacks)
1877#else
1876#else
1878 let cycleInfo = ""
1877 let cycleInfo = ""
@@ -2116,11 +2115,11 @@ runFrame a = SpiderHost $ do
2116 return result
2115 return result
2117 result <- runEventM go
2116 result <- runEventM go
2118 toClear <- readIORef $ eventEnvClears env
2117 toClear <- readIORef $ eventEnvClears env
2119− forM_ toClear $ \(Some.This (Clear ref)) -> {-# SCC "clear" #-} writeIORef ref Nothing
2118+ forM_ toClear $ \(Some (Clear ref)) -> {-# SCC "clear" #-} writeIORef ref Nothing
2120 toClearInt <- readIORef $ eventEnvIntClears env
2119 toClearInt <- readIORef $ eventEnvIntClears env
2121− forM_ toClearInt $ \(Some.This (IntClear ref)) -> {-# SCC "intClear" #-} writeIORef ref $! IntMap.empty
2120+ forM_ toClearInt $ \(Some (IntClear ref)) -> {-# SCC "intClear" #-} writeIORef ref $! IntMap.empty
2122 toClearRoot <- readIORef $ eventEnvRootClears env
2121 toClearRoot <- readIORef $ eventEnvRootClears env
2123− forM_ toClearRoot $ \(Some.This (RootClear ref)) -> {-# SCC "rootClear" #-} writeIORef ref $! DMap.empty
2122+ forM_ toClearRoot $ \(Some (RootClear ref)) -> {-# SCC "rootClear" #-} writeIORef ref $! DMap.empty
2124 toAssign <- readIORef $ eventEnvAssignments env
2123 toAssign <- readIORef $ eventEnvAssignments env
2125 toReconnectRef <- newIORef []
2124 toReconnectRef <- newIORef []
2126 coincidenceInfos <- readIORef $ eventEnvResetCoincidences env
2125 coincidenceInfos <- readIORef $ eventEnvResetCoincidences env
@@ -2480,7 +2479,7 @@ unsafeNewSpiderTimelineEnv = do
2480
2479
2481-- | Create a new SpiderTimelineEnv
2480-- | Create a new SpiderTimelineEnv
2482newSpiderTimeline :: IO (Some SpiderTimelineEnv)
2481newSpiderTimeline :: IO (Some SpiderTimelineEnv)
2483−newSpiderTimeline = withSpiderTimeline (pure . Some.This)
2482+newSpiderTimeline = withSpiderTimeline (pure . Some)
2484
2483
2485data LocalSpiderTimeline (x :: Type) s
2484data LocalSpiderTimeline (x :: Type) s
2486
2485