Skip to content

Commit 1024703

Browse files
committed
Fix deprecation warnings related to updated Data.Some
1 parent def4c30 commit 1024703

File tree

7 files changed

+35
-41
lines changed

7 files changed

+35
-41
lines changed

reflex.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ library
4747
constraints-extras >= 0.2,
4848
containers >= 0.5 && < 0.7,
4949
data-default >= 0.5 && < 0.8,
50-
dependent-map >= 0.2.4 && < 0.3,
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,

src/Data/Functor/Misc.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ import Data.IntMap (IntMap)
5252
import qualified Data.IntMap as IntMap
5353
import Data.Map (Map)
5454
import qualified Data.Map as Map
55-
import Data.Some (Some)
56-
import qualified Data.Some as Some
55+
import Data.Some (Some(Some))
5756
import Data.These
5857
import 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'
123122
weakenDMapWith :: (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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ import qualified Data.IntMap.Strict as IntMap
193193
import Data.List.NonEmpty (NonEmpty (..))
194194
import Data.Map (Map)
195195
import Data.Semigroup (Semigroup, sconcat, stimes, (<>))
196-
import Data.Some (Some)
197-
import qualified Data.Some as Some
196+
import Data.Some (Some(Some))
198197
import Data.String
199198
import Data.These
200199
import Data.Type.Coercion
@@ -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))))
11571156
factorEvent 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'

src/Reflex/Patch/DMapWithMove.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ import Data.GADT.Show (GShow, gshow)
3030
import qualified Data.Map as Map
3131
import Data.Maybe
3232
import Data.Semigroup (Semigroup (..), (<>))
33-
import Data.Some (Some)
34-
import qualified Data.Some as Some
33+
import Data.Some (Some(Some))
3534
import Data.These
3635

3736
-- | 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
@@ -311,8 +310,8 @@ weakenPatchDMapWithMoveWith f (PatchDMapWithMove p) = PatchMapWithMove $ weakenD
311310
{ MapWithMove._nodeInfo_from = case _nodeInfo_from ni of
312311
From_Insert v -> MapWithMove.From_Insert $ f v
313312
From_Delete -> MapWithMove.From_Delete
314-
From_Move k -> MapWithMove.From_Move $ Some.This k
315-
, 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)
316315
}
317316

318317
-- |"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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ import Data.Map (Map)
3838
import qualified Data.Map as Map
3939
import Data.Monoid ((<>))
4040
import qualified Data.Semigroup as S
41-
import Data.Some (Some)
42-
import qualified Data.Some as Some
41+
import Data.Some (Some(Some))
4342
import Data.These
4443

4544
import Reflex.Class
@@ -145,10 +144,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
145144
liftedResult' = fforCheap result' $ \(PatchDMap p) -> PatchDMap $
146145
mapKeyValuePairsMonotonic (\(k :=> ComposeMaybe mr) -> k :=> ComposeMaybe (fmap (getQueryTLoweredResultValue . getCompose) mr)) p
147146
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
149148
liftedBs' :: Event t (PatchMap (Some k) [Behavior t q])
150149
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
152151
sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
153152
sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
154153
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
189188
let liftedResult0 = mapKeyValuePairsMonotonic (\(k :=> Compose r) -> k :=> getQueryTLoweredResultValue r) result0
190189
liftedResult' = fforCheap result' $ mapPatchDMapWithMove (getQueryTLoweredResultValue . getCompose)
191190
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
193192
liftedBs' :: Event t (PatchMapWithMove (Some k) [Behavior t q])
194193
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 -}
196195
sampleBs :: forall m'. MonadSample t m' => [Behavior t q] -> m' q
197196
sampleBs = foldlM (\b a -> (b <>) <$> sample a) mempty
198197
accumBehaviors' :: forall m'. MonadHold t m'

src/Reflex/Requester/Base.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ import qualified Data.Map as Map
6666
import Data.Monoid ((<>))
6767
import Data.Proxy
6868
import qualified Data.Semigroup as S
69-
import Data.Some (Some)
70-
import qualified Data.Some as Some
69+
import Data.Some (Some(Some))
7170
import Data.Type.Equality
7271
import 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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ import Data.Tree (Forest, Tree (..), drawForest)
7474
import Data.FastWeakBag (FastWeakBag)
7575
import qualified Data.FastWeakBag as FastWeakBag
7676
import Data.Reflection
77-
import Data.Some (Some)
78-
import qualified Data.Some as Some
77+
import Data.Some (Some(Some))
7978
import Data.Type.Coercion
8079
import Data.WeakBag (WeakBag, WeakBagTicket, _weakBag_children)
8180
import 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

626625
walkInvalidHeightParents :: EventSubscribed x -> IO [Some (EventSubscribed x)]
627626
walkInvalidHeightParents 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 (Some.This (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 (Some.This (BehaviorSubscribedPull subscribed)) :))
680+
askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (Some (BehaviorSubscribedPull subscribed)) :))
682681
return a
683682

684683
behaviorDyn :: Patch p => Dyn x p -> Behavior x (PatchTarget p)
@@ -689,7 +688,7 @@ readHoldTracked :: Hold x p -> BehaviorM x (PatchTarget p)
689688
readHoldTracked 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 (Some.This (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

@@ -862,23 +861,23 @@ instance HasSpiderTimeline x => Defer (Some Clear) (EventM x) where
862861

863862
{-# INLINE scheduleClear #-}
864863
scheduleClear :: Defer (Some Clear) m => IORef (Maybe a) -> m ()
865-
scheduleClear r = defer $ Some.This $ Clear r
864+
scheduleClear r = defer $ Some $ Clear r
866865

867866
instance HasSpiderTimeline x => Defer (Some IntClear) (EventM x) where
868867
{-# INLINE getDeferralQueue #-}
869868
getDeferralQueue = asksEventEnv eventEnvIntClears
870869

871870
{-# INLINE scheduleIntClear #-}
872871
scheduleIntClear :: Defer (Some IntClear) m => IORef (IntMap a) -> m ()
873-
scheduleIntClear r = defer $ Some.This $ IntClear r
872+
scheduleIntClear r = defer $ Some $ IntClear r
874873

875874
instance HasSpiderTimeline x => Defer (Some RootClear) (EventM x) where
876875
{-# INLINE getDeferralQueue #-}
877876
getDeferralQueue = asksEventEnv eventEnvRootClears
878877

879878
{-# INLINE scheduleRootClear #-}
880879
scheduleRootClear :: Defer (Some RootClear) m => IORef (DMap k Identity) -> m ()
881-
scheduleRootClear r = defer $ Some.This $ RootClear r
880+
scheduleRootClear r = defer $ Some $ RootClear r
882881

883882
instance HasSpiderTimeline x => Defer (SomeResetCoincidence x) (EventM x) where
884883
{-# INLINE getDeferralQueue #-}
@@ -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 $ \(Some.This (Clear 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 $ \(Some.This (IntClear 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 $ \(Some.This (RootClear 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
24622461
newSpiderTimeline :: IO (Some SpiderTimelineEnv)
2463-
newSpiderTimeline = withSpiderTimeline (pure . Some.This)
2462+
newSpiderTimeline = withSpiderTimeline (pure . Some)
24642463

24652464
data LocalSpiderTimeline x s
24662465

0 commit comments

Comments
 (0)