on develop help sign in
Remove some more long-deprecated functions
6882aa8Ali Abrar
src/Reflex/Class.hs−25
@@ -148,9 +148,6 @@ module Reflex.Class
148 , ffor2
148 , ffor2
149 , ffor3
149 , ffor3
150 -- * Deprecated functions
150 -- * Deprecated functions
151− , appendEvents
152− , onceE
153− , sequenceThese
154 , switchPromptly
151 , switchPromptly
155 , switchPromptOnly
152 , switchPromptOnly
156 -- * "Cheap" functions
153 -- * "Cheap" functions
@@ -1464,28 +1461,6 @@ mergeWithFoldCheap' f es =
1464-- Deprecated functions
1461-- Deprecated functions
1465--------------------------------------------------------------------------------
1462--------------------------------------------------------------------------------
1466
1463
1467−-- | Create a new 'Event' that occurs if at least one of the supplied 'Event's
1468−-- occurs. If both occur at the same time they are combined using 'mappend'.
1469−{-# DEPRECATED appendEvents "If a 'Semigroup a' instance is available, use 'mappend'; otherwise, use 'alignWith (mergeThese mappend)' instead" #-}
1470−appendEvents :: (Reflex t, Monoid a) => Event t a -> Event t a -> Event t a
1471−appendEvents = alignWith $ mergeThese mappend
1472−
1473−-- | Alias for 'headE'
1474−{-# DEPRECATED onceE "Use 'headE' instead" #-}
1475−onceE :: MonadHold t m => Event t a -> m (Event t a)
1476−onceE = headE
1477−
1478−-- | Run both sides of a 'These' monadically, combining the results.
1479−{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
1480−#ifdef USE_TEMPLATE_HASKELL
1481−{-# ANN sequenceThese "HLint: ignore Use fmap" #-}
1482−#endif
1483−sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
1484−sequenceThese t = case t of
1485− This ma -> fmap This ma
1486− These ma mb -> liftM2 These ma mb
1487− That mb -> fmap That mb
1488−
1489{-# DEPRECATED switchPromptly "Use 'switchHoldPromptly' instead. The 'switchHold*' naming convention was chosen because those functions are more closely related to each other than they are to 'switch'. " #-}
1464{-# DEPRECATED switchPromptly "Use 'switchHoldPromptly' instead. The 'switchHold*' naming convention was chosen because those functions are more closely related to each other than they are to 'switch'. " #-}
1490switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1465switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1491switchPromptly = switchHoldPromptly
1466switchPromptly = switchHoldPromptly
src/Reflex/Collection.hs−10
@@ -20,7 +20,6 @@ module Reflex.Collection
20 -- * Widgets on Collections
20 -- * Widgets on Collections
21 listHoldWithKey
21 listHoldWithKey
22 , listWithKey
22 , listWithKey
23− , listWithKey'
24 , listWithKeyShallowDiff
23 , listWithKeyShallowDiff
25 , listViewWithKey
24 , listViewWithKey
26 , selectViewListWithKey
25 , selectViewListWithKey
@@ -104,15 +103,6 @@ listWithKey vals mkChild = do
104 listHoldWithKey Map.empty changeVals $ \k v ->
103 listHoldWithKey Map.empty changeVals $ \k v ->
105 mkChild k =<< holdDyn v (select childValChangedSelector $ Const2 k)
104 mkChild k =<< holdDyn v (select childValChangedSelector $ Const2 k)
106
105
107−{-# DEPRECATED listWithKey' "listWithKey' has been renamed to listWithKeyShallowDiff; also, its behavior has changed to fix a bug where children were always rebuilt (never updated)" #-}
108−listWithKey'
109− :: (Ord k, Adjustable t m, MonadFix m, MonadHold t m)
110− => Map k v
111− -> Event t (Map k (Maybe v))
112− -> (k -> v -> Event t v -> m a)
113− -> m (Dynamic t (Map k a))
114−listWithKey' = listWithKeyShallowDiff
115−
116-- | Display the given map of items (in key order) using the builder
106-- | Display the given map of items (in key order) using the builder
117-- function provided, and update it with the given event. 'Nothing'
107-- function provided, and update it with the given event. 'Nothing'
118-- update entries will delete the corresponding children, and 'Just'
108-- update entries will delete the corresponding children, and 'Just'
src/Reflex/Dynamic.hs+1−152
@@ -74,32 +74,12 @@ module Reflex.Dynamic
74 , distributeFHListOverDynPure
74 , distributeFHListOverDynPure
75 -- * Unsafe
75 -- * Unsafe
76 , unsafeDynamic
76 , unsafeDynamic
77− -- * Deprecated functions
78− , apDyn
79− , attachDyn
80− , attachDynWith
81− , attachDynWithMaybe
82− , collectDyn
83− , combineDyn
84− , distributeDMapOverDyn
85− , distributeFHListOverDyn
86− , forDyn
87− , getDemuxed
88− , joinDyn
89− , mapDyn
90− , mconcatDyn
91− , nubDyn
92− , splitDyn
93− , tagDyn
94− , uniqDyn
95− , uniqDynBy
96 ) where
77 ) where
97
78
98import Data.Functor.Compose
79import Data.Functor.Compose
99import Data.Functor.Misc
80import Data.Functor.Misc
100import Reflex.Class
81import Reflex.Class
101
82
102−import Control.Applicative ((<*>))
103import Control.Monad
83import Control.Monad
104import Control.Monad.Fix
84import Control.Monad.Fix
105import Control.Monad.Identity
85import Control.Monad.Identity
@@ -239,7 +219,7 @@ distributeListOverDynPure =
239-- | Combine a 'Dynamic' of a 'Map' of 'Dynamic's into a 'Dynamic'
219-- | Combine a 'Dynamic' of a 'Map' of 'Dynamic's into a 'Dynamic'
240-- with the current values of the 'Dynamic's in a map.
220-- with the current values of the 'Dynamic's in a map.
241joinDynThroughMap :: forall t k a. (Reflex t, Ord k) => Dynamic t (Map k (Dynamic t a)) -> Dynamic t (Map k a)
221joinDynThroughMap :: forall t k a. (Reflex t, Ord k) => Dynamic t (Map k (Dynamic t a)) -> Dynamic t (Map k a)
242−joinDynThroughMap = joinDyn . fmap distributeMapOverDynPure
222+joinDynThroughMap = join . fmap distributeMapOverDynPure
243
223
244-- | Print the value of the 'Dynamic' when it is first read and on each
224-- | Print the value of the 'Dynamic' when it is first read and on each
245-- subsequent change that is observed (as 'traceEvent'), prefixed with the
225-- subsequent change that is observed (as 'traceEvent'), prefixed with the
@@ -550,134 +530,3 @@ instance IsHList (a, b, c, d, e, f) where
550#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ < 800
530#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ < 800
551 _ -> error "fromHList: impossible" -- Otherwise, GHC complains of a non-exhaustive pattern match; see https://ghc.haskell.org/trac/ghc/ticket/4139
531 _ -> error "fromHList: impossible" -- Otherwise, GHC complains of a non-exhaustive pattern match; see https://ghc.haskell.org/trac/ghc/ticket/4139
552#endif
532#endif
553−
554−--------------------------------------------------------------------------------
555−-- Deprecated functions
556−--------------------------------------------------------------------------------
557−
558−-- | Map a function over a 'Dynamic'.
559−{-# DEPRECATED mapDyn "Use 'return . fmap f' instead of 'mapDyn f'; consider eliminating monadic style" #-}
560−mapDyn :: (Reflex t, Monad m) => (a -> b) -> Dynamic t a -> m (Dynamic t b)
561−mapDyn f = return . fmap f
562−
563−-- | Flipped version of 'mapDyn'.
564−{-# DEPRECATED forDyn "Use 'return . ffor a' instead of 'forDyn a'; consider eliminating monadic style" #-}
565−forDyn :: (Reflex t, Monad m) => Dynamic t a -> (a -> b) -> m (Dynamic t b)
566−forDyn a = return . ffor a
567−
568−-- | Split the 'Dynamic' into two 'Dynamic's, each taking the respective value
569−-- of the tuple.
570−{-# DEPRECATED splitDyn "Use 'return . splitDynPure' instead; consider eliminating monadic style" #-}
571−splitDyn :: (Reflex t, Monad m) => Dynamic t (a, b) -> m (Dynamic t a, Dynamic t b)
572−splitDyn = return . splitDynPure
573−
574−-- | Merge the 'Dynamic' values using their 'Monoid' instance.
575−{-# DEPRECATED mconcatDyn "Use 'return . mconcat' instead; consider eliminating monadic style" #-}
576−mconcatDyn :: forall t m a. (Reflex t, Monad m, Monoid a) => [Dynamic t a] -> m (Dynamic t a)
577−mconcatDyn = return . mconcat
578−
579−-- | This function no longer needs to be monadic; see 'distributeMapOverDynPure'.
580−{-# DEPRECATED distributeDMapOverDyn "Use 'return . distributeDMapOverDynPure' instead; consider eliminating monadic style" #-}
581−distributeDMapOverDyn :: (Reflex t, Monad m, GCompare k) => DMap k (Dynamic t) -> m (Dynamic t (DMap k Identity))
582−distributeDMapOverDyn = return . distributeDMapOverDynPure
583−
584−-- | Merge two 'Dynamic's into a new one using the provided function. The new
585−-- 'Dynamic' changes its value each time one of the original 'Dynamic's changes
586−-- its value.
587−{-# DEPRECATED combineDyn "Use 'return (zipDynWith f a b)' instead of 'combineDyn f a b'; consider eliminating monadic style" #-}
588−combineDyn :: forall t m a b c. (Reflex t, Monad m) => (a -> b -> c) -> Dynamic t a -> Dynamic t b -> m (Dynamic t c)
589−combineDyn f a b = return $ zipDynWith f a b
590−
591−-- | A pseudo applicative version of ap for 'Dynamic'. Example useage:
592−--
593−-- > do
594−-- > person <- Person `mapDyn` dynFirstName
595−-- > `apDyn` dynListName
596−-- > `apDyn` dynAge
597−-- > `apDyn` dynAddress
598−{-# DEPRECATED apDyn "Use 'ffor m (<*> a)' instead of 'apDyn m a'; consider eliminating monadic style, since Dynamics are now Applicative and can be used with applicative style directly" #-}
599−#ifdef USE_TEMPLATE_HASKELL
600−{-# ANN apDyn "HLint: ignore Use fmap" #-}
601−#endif
602−apDyn :: forall t m a b. (Reflex t, Monad m)
603− => m (Dynamic t (a -> b))
604− -> Dynamic t a
605− -> m (Dynamic t b)
606−apDyn m a = fmap (<*> a) m
607−
608−--TODO: The pattern of using hold (sample b0) can be reused in various places as a safe way of building certain kinds of Dynamics; see if we can factor this out
609−-- | This function no longer needs to be monadic, so it has been replaced by
610−-- 'demuxed', which is pure.
611−{-# DEPRECATED getDemuxed "Use 'return . demuxed d' instead of 'getDemuxed d'; consider eliminating monadic style" #-}
612−getDemuxed :: (Reflex t, Monad m, Eq k) => Demux t k -> k -> m (Dynamic t Bool)
613−getDemuxed d = return . demuxed d
614−
615−-- | This function no longer needs to be monadic, so it has been replaced by
616−-- 'distributeFHListOverDynPure', which is pure.
617−{-# DEPRECATED distributeFHListOverDyn "Use 'return . distributeFHListOverDynPure' instead; consider eliminating monadic style" #-}
618−distributeFHListOverDyn :: forall t m l. (Reflex t, Monad m, RebuildSortedHList l) => FHList (Dynamic t) l -> m (Dynamic t (HList l))
619−distributeFHListOverDyn = return . distributeFHListOverDynPure
620−
621−-- | This function no longer needs to be monadic, so it has been replaced by
622−-- 'collectDynPure', which is pure.
623−{-# DEPRECATED collectDyn "Use 'return . collectDynPure' instead; consider eliminating monadic style" #-}
624−collectDyn :: ( RebuildSortedHList (HListElems b)
625− , IsHList a, IsHList b
626− , AllAreFunctors (Dynamic t) (HListElems b)
627− , Reflex t, Monad m
628− , HListElems a ~ FunctorList (Dynamic t) (HListElems b)
629− ) => a -> m (Dynamic t b)
630−collectDyn = return . collectDynPure
631−
632−-- | This function has been renamed to 'tagPromptlyDyn' to clarify its
633−-- semantics.
634−{-# DEPRECATED tagDyn "Use 'tagPromptlyDyn' instead" #-}
635−tagDyn :: Reflex t => Dynamic t a -> Event t b -> Event t a
636−tagDyn = tagPromptlyDyn
637−
638−-- | This function has been renamed to 'attachPromptlyDyn' to clarify its
639−-- semantics.
640−{-# DEPRECATED attachDyn "Use 'attachPromptlyDyn' instead" #-}
641−attachDyn :: Reflex t => Dynamic t a -> Event t b -> Event t (a, b)
642−attachDyn = attachPromptlyDyn
643−
644−-- | This function has been renamed to 'attachPromptlyDynWith' to clarify its
645−-- semantics.
646−{-# DEPRECATED attachDynWith "Use 'attachPromptlyDynWith' instead" #-}
647−attachDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c
648−attachDynWith = attachPromptlyDynWith
649−
650−-- | This function has been renamed to 'attachPromptlyDynWithMaybe' to clarify
651−-- its semantics.
652−{-# DEPRECATED attachDynWithMaybe "Use 'attachPromptlyDynWithMaybe' instead" #-}
653−attachDynWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Dynamic t a -> Event t b -> Event t c
654−attachDynWithMaybe = attachPromptlyDynWithMaybe
655−
656−-- | Combine an inner and outer 'Dynamic' such that the resulting 'Dynamic''s
657−-- current value will always be equal to the current value's current value, and
658−-- will change whenever either the inner or the outer (or both) values change.
659−{-# DEPRECATED joinDyn "Use 'join' instead" #-}
660−joinDyn :: Reflex t => Dynamic t (Dynamic t a) -> Dynamic t a
661−joinDyn = join
662−
663−-- | WARNING: This function is only pure if @a@'s 'Eq' instance tests
664−-- representational equality. Use 'holdUniqDyn' instead, which is pure in all
665−-- circumstances. Also, note that, unlike 'nub', this function does not prevent
666−-- all recurrences of a value, only consecutive recurrences.
667−{-# DEPRECATED nubDyn "Use 'holdUniqDyn' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
668−nubDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a
669−nubDyn = uniqDyn
670−
671−-- | WARNING: This function is only pure if @a@'s 'Eq' instance tests
672−-- representational equality. Use 'holdUniqDyn' instead, which is pure in all
673−-- circumstances.
674−{-# DEPRECATED uniqDyn "Use 'holdUniqDyn' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
675−uniqDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a
676−uniqDyn = uniqDynBy (==)
677−
678−-- | WARNING: This function is impure. Use 'holdUniqDynBy' instead.
679−{-# DEPRECATED uniqDynBy "Use 'holdUniqDynBy' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
680−uniqDynBy :: Reflex t => (a -> a -> Bool) -> Dynamic t a -> Dynamic t a
681−uniqDynBy eq d =
682− let e' = attachWithMaybe (\x x' -> if x' `eq` x then Nothing else Just x') (current d) (updated d)
683− in unsafeDynamic (current d) e'
src/Reflex/Dynamic/TH.hs−24
@@ -13,9 +13,6 @@ module Reflex.Dynamic.TH
13 ( qDynPure
13 ( qDynPure
14 , unqDyn
14 , unqDyn
15 , mkDynPure
15 , mkDynPure
16− -- * Deprecated functions
17− , qDyn
18− , mkDyn
19 ) where
16 ) where
20
17
21import Reflex.Dynamic
18import Reflex.Dynamic
@@ -107,24 +104,3 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
107 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
104 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
108 | modName == modName' && occName == occName' = 'unqMarker
105 | modName == modName' && occName == occName' = 'unqMarker
109 reinstateUnqDyn x = x
106 reinstateUnqDyn x = x
110−
111−--------------------------------------------------------------------------------
112−-- Deprecated
113−--------------------------------------------------------------------------------
114−
115−{-# DEPRECATED qDyn "Instead of $(qDyn x), use return $(qDynPure x)" #-}
116−-- | Like 'qDynPure', but wraps its result monadically using 'return'. This is
117−-- no longer necessary, due to 'Dynamic' being an instance of 'Functor'.
118−qDyn :: Q Exp -> Q Exp
119−qDyn qe = [| return $(qDynPure qe) |]
120−
121−{-# DEPRECATED mkDyn "Instead of [mkDyn| x |], use return [mkDynPure| x |]" #-}
122−-- | Like 'mkDynPure', but wraps its result monadically using 'return'. This is
123−-- no longer necessary, due to 'Dynamic' being an instance of 'Functor'.
124−mkDyn :: QuasiQuoter
125−mkDyn = QuasiQuoter
126− { quoteExp = \s -> [| return $(mkDynExp s) |]
127− , quotePat = error "mkDyn: pattern splices are not supported"
128− , quoteType = error "mkDyn: type splices are not supported"
129− , quoteDec = error "mkDyn: declaration splices are not supported"
130− }