on develop help sign in
Merge pull request #285 from reflex-frp/aa-cleanup

Cleanup and delete long-deprecated things

commitbe5e6392c1f9fe251a64749cddf86232835c6e8b authorRyan Trinkle <ryan.trinkle@gmail.com> dateSun 17 Mar 2019, 15:15 (8 years ago) parent319fe5f6882aa8
12 files changed+18−276
src/Data/AppendMap.hs−11 src/Data/Functor/Misc.hs+1−44 src/Reflex/Class.hs+3−27 src/Reflex/Collection.hs−10 src/Reflex/Dynamic.hs+2−154 src/Reflex/Dynamic/TH.hs+1−25 src/Reflex/DynamicWriter/Base.hs+1−1 src/Reflex/NotReady/Class.hs+1−1 src/Reflex/Patch.hs+6 src/Reflex/Patch/Class.hs+1−1 src/Reflex/Query/Class.hs+1−1 src/Reflex/Time.hs+1−1
src/Data/AppendMap.hs−11
@@ -1,15 +1,10 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE DeriveFunctor #-}
3−{-# LANGUAGE DeriveGeneric #-}
4−{-# LANGUAGE DeriveTraversable #-}
52{-# LANGUAGE FlexibleContexts #-}
63{-# LANGUAGE FlexibleInstances #-}
7−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
84{-# LANGUAGE MultiParamTypeClasses #-}
95{-# LANGUAGE PatternSynonyms #-}
106{-# LANGUAGE RoleAnnotations #-}
117{-# LANGUAGE ScopedTypeVariables #-}
12−{-# LANGUAGE StandaloneDeriving #-}
138{-# LANGUAGE TypeFamilies #-}
149{-# OPTIONS_GHC -fno-warn-orphans #-}
1510-- | 'Data.Map' with a better 'Monoid' instance
@@ -33,7 +28,6 @@ import qualified Data.Map as Map (showTree, showTreeWith)
3328#endif
3429import Data.Map.Monoidal
3530import Reflex.Class (FunctorMaybe (..))
36−import Reflex.Patch (Additive, Group (..))
3731
3832{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
3933type AppendMap = MonoidalMap
@@ -66,11 +60,6 @@ mapMaybeNoNull f as =
6660 else Just bs
6761
6862-- TODO: Move instances to `Reflex.Patch`
69−instance (Ord k, Group q) => Group (MonoidalMap k q) where
70− negateG = map negateG
71−
72−instance (Ord k, Additive q) => Additive (MonoidalMap k q)
73−
7463showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
7564showTree = coerce (Map.showTree :: Map k a -> String)
7665
src/Data/Functor/Misc.hs+1−44
@@ -38,17 +38,10 @@ module Data.Functor.Misc
3838 , dmapToThese
3939 , eitherToDSum
4040 , dsumToEither
41− -- * Deprecated functions
42− , sequenceDmap
43− , wrapDMap
44− , rewrapDMap
45− , unwrapDMap
46− , unwrapDMapMaybe
47− , extractFunctorDMap
4841 , ComposeMaybe (..)
4942 ) where
5043
51−import Control.Applicative (Applicative, (<$>))
44+import Control.Applicative ((<$>))
5245import Control.Monad.Identity
5346import Data.Dependent.Map (DMap)
5447import qualified Data.Dependent.Map as DMap
@@ -249,39 +242,3 @@ newtype ComposeMaybe f a =
249242 ComposeMaybe { getComposeMaybe :: Maybe (f a) } deriving (Show, Eq, Ord)
250243
251244deriving instance Functor f => Functor (ComposeMaybe f)
252−
253−--------------------------------------------------------------------------------
254−-- Deprecated functions
255−--------------------------------------------------------------------------------
256−
257−{-# INLINE sequenceDmap #-}
258−{-# DEPRECATED sequenceDmap "Use 'Data.Dependent.Map.traverseWithKey (\\_ -> fmap Identity)' instead" #-}
259−-- | Run the actions contained in the 'DMap'
260−sequenceDmap :: Applicative t => DMap f t -> t (DMap f Identity)
261−sequenceDmap = DMap.traverseWithKey $ \_ t -> Identity <$> t
262−
263−{-# DEPRECATED wrapDMap "Use 'Data.Dependent.Map.map (f . runIdentity)' instead" #-}
264−-- | Replace the 'Identity' functor for a 'DMap''s values with a different functor
265−wrapDMap :: (forall a. a -> f a) -> DMap k Identity -> DMap k f
266−wrapDMap f = DMap.map $ f . runIdentity
267−
268−{-# DEPRECATED rewrapDMap "Use 'Data.Dependent.Map.map' instead" #-}
269−-- | Replace one functor for a 'DMap''s values with a different functor
270−rewrapDMap :: (forall (a :: *). f a -> g a) -> DMap k f -> DMap k g
271−rewrapDMap = DMap.map
272−
273−{-# DEPRECATED unwrapDMap "Use 'Data.Dependent.Map.map (Identity . f)' instead" #-}
274−-- | Replace one functor for a 'DMap''s values with the 'Identity' functor
275−unwrapDMap :: (forall a. f a -> a) -> DMap k f -> DMap k Identity
276−unwrapDMap f = DMap.map $ Identity . f
277−
278−{-# DEPRECATED unwrapDMapMaybe "Use 'Data.Dependent.Map.mapMaybeWithKey (\\_ a -> fmap Identity $ f a)' instead" #-}
279−-- | Like 'unwrapDMap', but possibly delete some values from the DMap
280−unwrapDMapMaybe :: GCompare k => (forall a. f a -> Maybe a) -> DMap k f -> DMap k Identity
281−unwrapDMapMaybe f = DMap.mapMaybeWithKey $ \_ a -> Identity <$> f a
282−
283−{-# DEPRECATED extractFunctorDMap "Use 'mapKeyValuePairsMonotonic (\\(Const2 k :=> Identity v) -> Const2 k :=> v)' instead" #-}
284−-- | Eliminate the 'Identity' functor in a 'DMap' and replace it with the
285−-- underlying functor
286−extractFunctorDMap :: DMap (Const2 k (f v)) Identity -> DMap (Const2 k v) f
287−extractFunctorDMap = mapKeyValuePairsMonotonic $ \(Const2 k :=> Identity v) -> Const2 k :=> v
src/Reflex/Class.hs+3−27
@@ -148,9 +148,9 @@ module Reflex.Class
148148 , ffor2
149149 , ffor3
150150 -- * Deprecated functions
151− , appendEvents
152− , onceE
153− , sequenceThese
151+ , switchPromptly
152+ , switchPromptOnly
153+ -- * "Cheap" functions
154154 , fmapMaybeCheap
155155 , fmapCheap
156156 , fforCheap
@@ -159,8 +159,6 @@ module Reflex.Class
159159 , tagCheap
160160 , mergeWithCheap
161161 , mergeWithCheap'
162− , switchPromptly
163− , switchPromptOnly
164162 -- * Slow, but general, implementations
165163 , slowHeadE
166164 ) where
@@ -1463,28 +1461,6 @@ mergeWithFoldCheap' f es =
14631461-- Deprecated functions
14641462--------------------------------------------------------------------------------
14651463
1466−-- | Create a new 'Event' that occurs if at least one of the supplied 'Event's
1467−-- occurs. If both occur at the same time they are combined using 'mappend'.
1468−{-# DEPRECATED appendEvents "If a 'Semigroup a' instance is available, use 'mappend'; otherwise, use 'alignWith (mergeThese mappend)' instead" #-}
1469−appendEvents :: (Reflex t, Monoid a) => Event t a -> Event t a -> Event t a
1470−appendEvents = alignWith $ mergeThese mappend
1471−
1472−-- | Alias for 'headE'
1473−{-# DEPRECATED onceE "Use 'headE' instead" #-}
1474−onceE :: MonadHold t m => Event t a -> m (Event t a)
1475−onceE = headE
1476−
1477−-- | Run both sides of a 'These' monadically, combining the results.
1478−{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
1479−#ifdef USE_TEMPLATE_HASKELL
1480−{-# ANN sequenceThese "HLint: ignore Use fmap" #-}
1481−#endif
1482−sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
1483−sequenceThese t = case t of
1484− This ma -> fmap This ma
1485− These ma mb -> liftM2 These ma mb
1486− That mb -> fmap That mb
1487−
14881464{-# 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'. " #-}
14891465switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
14901466switchPromptly = switchHoldPromptly
src/Reflex/Collection.hs−10
@@ -18,7 +18,6 @@ module Reflex.Collection
1818 -- * Widgets on Collections
1919 listHoldWithKey
2020 , listWithKey
21− , listWithKey'
2221 , listWithKeyShallowDiff
2322 , listViewWithKey
2423 , selectViewListWithKey
@@ -102,15 +101,6 @@ listWithKey vals mkChild = do
102101 listHoldWithKey Map.empty changeVals $ \k v ->
103102 mkChild k =<< holdDyn v (select childValChangedSelector $ Const2 k)
104103
105−{-# DEPRECATED listWithKey' "listWithKey' has been renamed to listWithKeyShallowDiff; also, its behavior has changed to fix a bug where children were always rebuilt (never updated)" #-}
106−listWithKey'
107− :: (Ord k, Adjustable t m, MonadFix m, MonadHold t m)
108− => Map k v
109− -> Event t (Map k (Maybe v))
110− -> (k -> v -> Event t v -> m a)
111− -> m (Dynamic t (Map k a))
112−listWithKey' = listWithKeyShallowDiff
113−
114104-- | Display the given map of items (in key order) using the builder
115105-- function provided, and update it with the given event. 'Nothing'
116106-- update entries will delete the corresponding children, and 'Just'
src/Reflex/Dynamic.hs+2−154
@@ -74,32 +74,12 @@ module Reflex.Dynamic
7474 , distributeFHListOverDynPure
7575 -- * Unsafe
7676 , 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
9677 ) where
9778
9879import Data.Functor.Compose
9980import Data.Functor.Misc
10081import Reflex.Class
10182
102−import Control.Applicative ((<*>))
10383import Control.Monad
10484import Control.Monad.Fix
10585import Control.Monad.Identity
@@ -107,11 +87,10 @@ import Data.Align
10787import Data.Dependent.Map (DMap)
10888import qualified Data.Dependent.Map as DMap
10989import Data.Dependent.Sum (DSum (..))
110−import Data.Functor.Product
11190import Data.GADT.Compare ((:~:) (..), GCompare (..), GEq (..), GOrdering (..))
11291import Data.Map (Map)
11392import Data.Maybe
114−import Data.Monoid hiding (Product)
93+import Data.Monoid ((<>))
11594import Data.These
11695
11796import Debug.Trace
@@ -240,7 +219,7 @@ distributeListOverDynPure =
240219-- | Combine a 'Dynamic' of a 'Map' of 'Dynamic's into a 'Dynamic'
241220-- with the current values of the 'Dynamic's in a map.
242221joinDynThroughMap :: forall t k a. (Reflex t, Ord k) => Dynamic t (Map k (Dynamic t a)) -> Dynamic t (Map k a)
243−joinDynThroughMap = joinDyn . fmap distributeMapOverDynPure
222+joinDynThroughMap = join . fmap distributeMapOverDynPure
244223
245224-- | Print the value of the 'Dynamic' when it is first read and on each
246225-- subsequent change that is observed (as 'traceEvent'), prefixed with the
@@ -551,134 +530,3 @@ instance IsHList (a, b, c, d, e, f) where
551530#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ < 800
552531 _ -> error "fromHList: impossible" -- Otherwise, GHC complains of a non-exhaustive pattern match; see https://ghc.haskell.org/trac/ghc/ticket/4139
553532#endif
554−
555−--------------------------------------------------------------------------------
556−-- Deprecated functions
557−--------------------------------------------------------------------------------
558−
559−-- | Map a function over a 'Dynamic'.
560−{-# DEPRECATED mapDyn "Use 'return . fmap f' instead of 'mapDyn f'; consider eliminating monadic style" #-}
561−mapDyn :: (Reflex t, Monad m) => (a -> b) -> Dynamic t a -> m (Dynamic t b)
562−mapDyn f = return . fmap f
563−
564−-- | Flipped version of 'mapDyn'.
565−{-# DEPRECATED forDyn "Use 'return . ffor a' instead of 'forDyn a'; consider eliminating monadic style" #-}
566−forDyn :: (Reflex t, Monad m) => Dynamic t a -> (a -> b) -> m (Dynamic t b)
567−forDyn a = return . ffor a
568−
569−-- | Split the 'Dynamic' into two 'Dynamic's, each taking the respective value
570−-- of the tuple.
571−{-# DEPRECATED splitDyn "Use 'return . splitDynPure' instead; consider eliminating monadic style" #-}
572−splitDyn :: (Reflex t, Monad m) => Dynamic t (a, b) -> m (Dynamic t a, Dynamic t b)
573−splitDyn = return . splitDynPure
574−
575−-- | Merge the 'Dynamic' values using their 'Monoid' instance.
576−{-# DEPRECATED mconcatDyn "Use 'return . mconcat' instead; consider eliminating monadic style" #-}
577−mconcatDyn :: forall t m a. (Reflex t, Monad m, Monoid a) => [Dynamic t a] -> m (Dynamic t a)
578−mconcatDyn = return . mconcat
579−
580−-- | This function no longer needs to be monadic; see 'distributeMapOverDynPure'.
581−{-# DEPRECATED distributeDMapOverDyn "Use 'return . distributeDMapOverDynPure' instead; consider eliminating monadic style" #-}
582−distributeDMapOverDyn :: (Reflex t, Monad m, GCompare k) => DMap k (Dynamic t) -> m (Dynamic t (DMap k Identity))
583−distributeDMapOverDyn = return . distributeDMapOverDynPure
584−
585−-- | Merge two 'Dynamic's into a new one using the provided function. The new
586−-- 'Dynamic' changes its value each time one of the original 'Dynamic's changes
587−-- its value.
588−{-# DEPRECATED combineDyn "Use 'return (zipDynWith f a b)' instead of 'combineDyn f a b'; consider eliminating monadic style" #-}
589−combineDyn :: forall t m a b c. (Reflex t, Monad m) => (a -> b -> c) -> Dynamic t a -> Dynamic t b -> m (Dynamic t c)
590−combineDyn f a b = return $ zipDynWith f a b
591−
592−-- | A pseudo applicative version of ap for 'Dynamic'. Example useage:
593−--
594−-- > do
595−-- > person <- Person `mapDyn` dynFirstName
596−-- > `apDyn` dynListName
597−-- > `apDyn` dynAge
598−-- > `apDyn` dynAddress
599−{-# 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" #-}
600−#ifdef USE_TEMPLATE_HASKELL
601−{-# ANN apDyn "HLint: ignore Use fmap" #-}
602−#endif
603−apDyn :: forall t m a b. (Reflex t, Monad m)
604− => m (Dynamic t (a -> b))
605− -> Dynamic t a
606− -> m (Dynamic t b)
607−apDyn m a = fmap (<*> a) m
608−
609−--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
610−-- | This function no longer needs to be monadic, so it has been replaced by
611−-- 'demuxed', which is pure.
612−{-# DEPRECATED getDemuxed "Use 'return . demuxed d' instead of 'getDemuxed d'; consider eliminating monadic style" #-}
613−getDemuxed :: (Reflex t, Monad m, Eq k) => Demux t k -> k -> m (Dynamic t Bool)
614−getDemuxed d = return . demuxed d
615−
616−-- | This function no longer needs to be monadic, so it has been replaced by
617−-- 'distributeFHListOverDynPure', which is pure.
618−{-# DEPRECATED distributeFHListOverDyn "Use 'return . distributeFHListOverDynPure' instead; consider eliminating monadic style" #-}
619−distributeFHListOverDyn :: forall t m l. (Reflex t, Monad m, RebuildSortedHList l) => FHList (Dynamic t) l -> m (Dynamic t (HList l))
620−distributeFHListOverDyn = return . distributeFHListOverDynPure
621−
622−-- | This function no longer needs to be monadic, so it has been replaced by
623−-- 'collectDynPure', which is pure.
624−{-# DEPRECATED collectDyn "Use 'return . collectDynPure' instead; consider eliminating monadic style" #-}
625−collectDyn :: ( RebuildSortedHList (HListElems b)
626− , IsHList a, IsHList b
627− , AllAreFunctors (Dynamic t) (HListElems b)
628− , Reflex t, Monad m
629− , HListElems a ~ FunctorList (Dynamic t) (HListElems b)
630− ) => a -> m (Dynamic t b)
631−collectDyn = return . collectDynPure
632−
633−-- | This function has been renamed to 'tagPromptlyDyn' to clarify its
634−-- semantics.
635−{-# DEPRECATED tagDyn "Use 'tagPromptlyDyn' instead" #-}
636−tagDyn :: Reflex t => Dynamic t a -> Event t b -> Event t a
637−tagDyn = tagPromptlyDyn
638−
639−-- | This function has been renamed to 'attachPromptlyDyn' to clarify its
640−-- semantics.
641−{-# DEPRECATED attachDyn "Use 'attachPromptlyDyn' instead" #-}
642−attachDyn :: Reflex t => Dynamic t a -> Event t b -> Event t (a, b)
643−attachDyn = attachPromptlyDyn
644−
645−-- | This function has been renamed to 'attachPromptlyDynWith' to clarify its
646−-- semantics.
647−{-# DEPRECATED attachDynWith "Use 'attachPromptlyDynWith' instead" #-}
648−attachDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c
649−attachDynWith = attachPromptlyDynWith
650−
651−-- | This function has been renamed to 'attachPromptlyDynWithMaybe' to clarify
652−-- its semantics.
653−{-# DEPRECATED attachDynWithMaybe "Use 'attachPromptlyDynWithMaybe' instead" #-}
654−attachDynWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Dynamic t a -> Event t b -> Event t c
655−attachDynWithMaybe = attachPromptlyDynWithMaybe
656−
657−-- | Combine an inner and outer 'Dynamic' such that the resulting 'Dynamic''s
658−-- current value will always be equal to the current value's current value, and
659−-- will change whenever either the inner or the outer (or both) values change.
660−{-# DEPRECATED joinDyn "Use 'join' instead" #-}
661−joinDyn :: Reflex t => Dynamic t (Dynamic t a) -> Dynamic t a
662−joinDyn = join
663−
664−-- | WARNING: This function is only pure if @a@'s 'Eq' instance tests
665−-- representational equality. Use 'holdUniqDyn' instead, which is pure in all
666−-- circumstances. Also, note that, unlike 'nub', this function does not prevent
667−-- all recurrences of a value, only consecutive recurrences.
668−{-# DEPRECATED nubDyn "Use 'holdUniqDyn' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
669−nubDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a
670−nubDyn = uniqDyn
671−
672−-- | WARNING: This function is only pure if @a@'s 'Eq' instance tests
673−-- representational equality. Use 'holdUniqDyn' instead, which is pure in all
674−-- circumstances.
675−{-# DEPRECATED uniqDyn "Use 'holdUniqDyn' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
676−uniqDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a
677−uniqDyn = uniqDynBy (==)
678−
679−-- | WARNING: This function is impure. Use 'holdUniqDynBy' instead.
680−{-# DEPRECATED uniqDynBy "Use 'holdUniqDynBy' instead; note that it returns a MonadHold action rather than a pure Dynamic" #-}
681−uniqDynBy :: Reflex t => (a -> a -> Bool) -> Dynamic t a -> Dynamic t a
682−uniqDynBy eq d =
683− let e' = attachWithMaybe (\x x' -> if x' `eq` x then Nothing else Just x') (current d) (updated d)
684− in unsafeDynamic (current d) e'
src/Reflex/Dynamic/TH.hs+1−25
@@ -13,9 +13,6 @@ module Reflex.Dynamic.TH
1313 ( qDynPure
1414 , unqDyn
1515 , mkDynPure
16− -- * Deprecated functions
17− , qDyn
18− , mkDyn
1916 ) where
2017
2118import Reflex.Dynamic
@@ -23,7 +20,7 @@ import Reflex.Dynamic
2320import Control.Monad.State
2421import Data.Data
2522import Data.Generics
26−import Data.Monoid
23+import Data.Monoid ((<>))
2724import qualified Language.Haskell.Exts as Hs
2825import qualified Language.Haskell.Meta.Syntax.Translate as Hs
2926import Language.Haskell.TH
@@ -107,24 +104,3 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
107104 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
108105 | modName == modName' && occName == occName' = 'unqMarker
109106 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− }
src/Reflex/DynamicWriter/Base.hs+1−1
@@ -35,7 +35,7 @@ import Data.IntMap (IntMap)
3535import qualified Data.IntMap as IntMap
3636import Data.Map (Map)
3737import qualified Data.Map as Map
38−import Data.Semigroup
38+import Data.Semigroup (Semigroup(..))
3939import Data.Some (Some)
4040import Data.These
4141
src/Reflex/NotReady/Class.hs+1−1
@@ -57,7 +57,7 @@ instance NotReady t m => NotReady t (DynamicWriterT t w m) where
5757 notReadyUntil = lift . notReadyUntil
5858 notReady = lift notReady
5959
60−instance (NotReady t m, Monoid w) => NotReady t (BehaviorWriterT t w m) where
60+instance NotReady t m => NotReady t (BehaviorWriterT t w m) where
6161 notReadyUntil = lift . notReadyUntil
6262 notReady = lift notReady
6363
src/Reflex/Patch.hs+6
@@ -21,6 +21,7 @@ import Reflex.Patch.Map as X
2121import Reflex.Patch.MapWithMove as X (PatchMapWithMove, patchMapWithMoveNewElements,
2222 patchMapWithMoveNewElementsMap, unPatchMapWithMove,
2323 unsafePatchMapWithMove)
24+import Data.Map.Monoidal (MonoidalMap)
2425import Data.Semigroup (Semigroup (..), (<>))
2526
2627-- | A 'Group' is a 'Monoid' where every element has an inverse.
@@ -38,3 +39,8 @@ newtype AdditivePatch p = AdditivePatch { unAdditivePatch :: p }
3839instance Additive p => Patch (AdditivePatch p) where
3940 type PatchTarget (AdditivePatch p) = p
4041 apply (AdditivePatch p) q = Just $ p <> q
42+
43+instance (Ord k, Group q) => Group (MonoidalMap k q) where
44+ negateG = fmap negateG
45+
46+instance (Ord k, Additive q) => Additive (MonoidalMap k q)
src/Reflex/Patch/Class.hs+1−1
@@ -4,7 +4,7 @@ module Reflex.Patch.Class where
44
55import Control.Monad.Identity
66import Data.Maybe
7−import Data.Semigroup
7+import Data.Semigroup (Semigroup(..))
88
99-- | A 'Patch' type represents a kind of change made to a datastructure.
1010--
src/Reflex/Query/Class.hs+1−1
@@ -27,7 +27,7 @@ import Data.Data
2727import Data.Ix
2828import Data.Map.Monoidal (MonoidalMap)
2929import qualified Data.Map.Monoidal as MonoidalMap
30−import Data.Semigroup
30+import Data.Semigroup (Semigroup(..))
3131import Foreign.Storable
3232
3333import Reflex.Class
src/Reflex/Time.hs+1−1
@@ -33,7 +33,7 @@ import Control.Monad.IO.Class
3333import Data.Align
3434import Data.Data (Data)
3535import Data.Fixed
36−import Data.Semigroup
36+import Data.Semigroup (Semigroup(..))
3737import Data.Sequence (Seq, (|>))
3838import qualified Data.Sequence as Seq
3939import Data.These