on develop help sign in
Merge pull request #285 from reflex-frp/aa-cleanup
be5e639Ryan Trinkle
src/Data/AppendMap.hs−11
@@ -1,15 +1,10 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−{-# LANGUAGE DeriveFunctor #-}
3−{-# LANGUAGE DeriveGeneric #-}
4−{-# LANGUAGE DeriveTraversable #-}
5{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
6{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
7−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
8{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
9{-# LANGUAGE PatternSynonyms #-}
5{-# LANGUAGE PatternSynonyms #-}
10{-# LANGUAGE RoleAnnotations #-}
6{-# LANGUAGE RoleAnnotations #-}
11{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE ScopedTypeVariables #-}
12−{-# LANGUAGE StandaloneDeriving #-}
13{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
14{-# OPTIONS_GHC -fno-warn-orphans #-}
9{-# OPTIONS_GHC -fno-warn-orphans #-}
15-- | 'Data.Map' with a better 'Monoid' instance
10-- | 'Data.Map' with a better 'Monoid' instance
@@ -33,7 +28,6 @@ import qualified Data.Map as Map (showTree, showTreeWith)
33#endif
28#endif
34import Data.Map.Monoidal
29import Data.Map.Monoidal
35import Reflex.Class (FunctorMaybe (..))
30import Reflex.Class (FunctorMaybe (..))
36−import Reflex.Patch (Additive, Group (..))
37
31
38{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
32{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
39type AppendMap = MonoidalMap
33type AppendMap = MonoidalMap
@@ -66,11 +60,6 @@ mapMaybeNoNull f as =
66 else Just bs
60 else Just bs
67
61
68-- TODO: Move instances to `Reflex.Patch`
62-- 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−
74showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
63showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
75showTree = coerce (Map.showTree :: Map k a -> String)
64showTree = coerce (Map.showTree :: Map k a -> String)
76
65
src/Data/Functor/Misc.hs+1−44
@@ -38,17 +38,10 @@ module Data.Functor.Misc
38 , dmapToThese
38 , dmapToThese
39 , eitherToDSum
39 , eitherToDSum
40 , dsumToEither
40 , dsumToEither
41− -- * Deprecated functions
42− , sequenceDmap
43− , wrapDMap
44− , rewrapDMap
45− , unwrapDMap
46− , unwrapDMapMaybe
47− , extractFunctorDMap
48 , ComposeMaybe (..)
41 , ComposeMaybe (..)
49 ) where
42 ) where
50
43
51−import Control.Applicative (Applicative, (<$>))
44+import Control.Applicative ((<$>))
52import Control.Monad.Identity
45import Control.Monad.Identity
53import Data.Dependent.Map (DMap)
46import Data.Dependent.Map (DMap)
54import qualified Data.Dependent.Map as DMap
47import qualified Data.Dependent.Map as DMap
@@ -249,39 +242,3 @@ newtype ComposeMaybe f a =
249 ComposeMaybe { getComposeMaybe :: Maybe (f a) } deriving (Show, Eq, Ord)
242 ComposeMaybe { getComposeMaybe :: Maybe (f a) } deriving (Show, Eq, Ord)
250
243
251deriving instance Functor f => Functor (ComposeMaybe f)
244deriving 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
148 , ffor2
148 , ffor2
149 , ffor3
149 , ffor3
150 -- * Deprecated functions
150 -- * Deprecated functions
151− , appendEvents
151+ , switchPromptly
152− , onceE
152+ , switchPromptOnly
153− , sequenceThese
153+ -- * "Cheap" functions
154 , fmapMaybeCheap
154 , fmapMaybeCheap
155 , fmapCheap
155 , fmapCheap
156 , fforCheap
156 , fforCheap
@@ -159,8 +159,6 @@ module Reflex.Class
159 , tagCheap
159 , tagCheap
160 , mergeWithCheap
160 , mergeWithCheap
161 , mergeWithCheap'
161 , mergeWithCheap'
162− , switchPromptly
163− , switchPromptOnly
164 -- * Slow, but general, implementations
162 -- * Slow, but general, implementations
165 , slowHeadE
163 , slowHeadE
166 ) where
164 ) where
@@ -1463,28 +1461,6 @@ mergeWithFoldCheap' f es =
1463-- Deprecated functions
1461-- Deprecated functions
1464--------------------------------------------------------------------------------
1462--------------------------------------------------------------------------------
1465
1463
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−
1488{-# 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'. " #-}
1489switchPromptly :: (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)
1490switchPromptly = switchHoldPromptly
1466switchPromptly = switchHoldPromptly
src/Reflex/Collection.hs−10
@@ -18,7 +18,6 @@ module Reflex.Collection
18 -- * Widgets on Collections
18 -- * Widgets on Collections
19 listHoldWithKey
19 listHoldWithKey
20 , listWithKey
20 , listWithKey
21− , listWithKey'
22 , listWithKeyShallowDiff
21 , listWithKeyShallowDiff
23 , listViewWithKey
22 , listViewWithKey
24 , selectViewListWithKey
23 , selectViewListWithKey
@@ -102,15 +101,6 @@ listWithKey vals mkChild = do
102 listHoldWithKey Map.empty changeVals $ \k v ->
101 listHoldWithKey Map.empty changeVals $ \k v ->
103 mkChild k =<< holdDyn v (select childValChangedSelector $ Const2 k)
102 mkChild k =<< holdDyn v (select childValChangedSelector $ Const2 k)
104
103
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−
114-- | Display the given map of items (in key order) using the builder
104-- | Display the given map of items (in key order) using the builder
115-- function provided, and update it with the given event. 'Nothing'
105-- function provided, and update it with the given event. 'Nothing'
116-- update entries will delete the corresponding children, and 'Just'
106-- update entries will delete the corresponding children, and 'Just'
src/Reflex/Dynamic.hs+2−154
@@ -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
@@ -107,11 +87,10 @@ import Data.Align
107import Data.Dependent.Map (DMap)
87import Data.Dependent.Map (DMap)
108import qualified Data.Dependent.Map as DMap
88import qualified Data.Dependent.Map as DMap
109import Data.Dependent.Sum (DSum (..))
89import Data.Dependent.Sum (DSum (..))
110−import Data.Functor.Product
111import Data.GADT.Compare ((:~:) (..), GCompare (..), GEq (..), GOrdering (..))
90import Data.GADT.Compare ((:~:) (..), GCompare (..), GEq (..), GOrdering (..))
112import Data.Map (Map)
91import Data.Map (Map)
113import Data.Maybe
92import Data.Maybe
114−import Data.Monoid hiding (Product)
93+import Data.Monoid ((<>))
115import Data.These
94import Data.These
116
95
117import Debug.Trace
96import Debug.Trace
@@ -240,7 +219,7 @@ distributeListOverDynPure =
240-- | 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'
241-- with the current values of the 'Dynamic's in a map.
220-- with the current values of the 'Dynamic's in a map.
242joinDynThroughMap :: 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)
243−joinDynThroughMap = joinDyn . fmap distributeMapOverDynPure
222+joinDynThroughMap = join . fmap distributeMapOverDynPure
244
223
245-- | 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
246-- subsequent change that is observed (as 'traceEvent'), prefixed with the
225-- subsequent change that is observed (as 'traceEvent'), prefixed with the
@@ -551,134 +530,3 @@ instance IsHList (a, b, c, d, e, f) where
551#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ < 800
530#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ < 800
552 _ -> 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
553#endif
532#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
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
@@ -23,7 +20,7 @@ import Reflex.Dynamic
23import Control.Monad.State
20import Control.Monad.State
24import Data.Data
21import Data.Data
25import Data.Generics
22import Data.Generics
26−import Data.Monoid
23+import Data.Monoid ((<>))
27import qualified Language.Haskell.Exts as Hs
24import qualified Language.Haskell.Exts as Hs
28import qualified Language.Haskell.Meta.Syntax.Translate as Hs
25import qualified Language.Haskell.Meta.Syntax.Translate as Hs
29import Language.Haskell.TH
26import Language.Haskell.TH
@@ -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− }
src/Reflex/DynamicWriter/Base.hs+1−1
@@ -35,7 +35,7 @@ import Data.IntMap (IntMap)
35import qualified Data.IntMap as IntMap
35import qualified Data.IntMap as IntMap
36import Data.Map (Map)
36import Data.Map (Map)
37import qualified Data.Map as Map
37import qualified Data.Map as Map
38−import Data.Semigroup
38+import Data.Semigroup (Semigroup(..))
39import Data.Some (Some)
39import Data.Some (Some)
40import Data.These
40import Data.These
41
41
src/Reflex/NotReady/Class.hs+1−1
@@ -57,7 +57,7 @@ instance NotReady t m => NotReady t (DynamicWriterT t w m) where
57 notReadyUntil = lift . notReadyUntil
57 notReadyUntil = lift . notReadyUntil
58 notReady = lift notReady
58 notReady = lift notReady
59
59
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
61 notReadyUntil = lift . notReadyUntil
61 notReadyUntil = lift . notReadyUntil
62 notReady = lift notReady
62 notReady = lift notReady
63
63
src/Reflex/Patch.hs+6
@@ -21,6 +21,7 @@ import Reflex.Patch.Map as X
21import Reflex.Patch.MapWithMove as X (PatchMapWithMove, patchMapWithMoveNewElements,
21import Reflex.Patch.MapWithMove as X (PatchMapWithMove, patchMapWithMoveNewElements,
22 patchMapWithMoveNewElementsMap, unPatchMapWithMove,
22 patchMapWithMoveNewElementsMap, unPatchMapWithMove,
23 unsafePatchMapWithMove)
23 unsafePatchMapWithMove)
24+import Data.Map.Monoidal (MonoidalMap)
24import Data.Semigroup (Semigroup (..), (<>))
25import Data.Semigroup (Semigroup (..), (<>))
25
26
26-- | A 'Group' is a 'Monoid' where every element has an inverse.
27-- | A 'Group' is a 'Monoid' where every element has an inverse.
@@ -38,3 +39,8 @@ newtype AdditivePatch p = AdditivePatch { unAdditivePatch :: p }
38instance Additive p => Patch (AdditivePatch p) where
39instance Additive p => Patch (AdditivePatch p) where
39 type PatchTarget (AdditivePatch p) = p
40 type PatchTarget (AdditivePatch p) = p
40 apply (AdditivePatch p) q = Just $ p <> q
41 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
4
4
5import Control.Monad.Identity
5import Control.Monad.Identity
6import Data.Maybe
6import Data.Maybe
7−import Data.Semigroup
7+import Data.Semigroup (Semigroup(..))
8
8
9-- | A 'Patch' type represents a kind of change made to a datastructure.
9-- | A 'Patch' type represents a kind of change made to a datastructure.
10--
10--
src/Reflex/Query/Class.hs+1−1
@@ -27,7 +27,7 @@ import Data.Data
27import Data.Ix
27import Data.Ix
28import Data.Map.Monoidal (MonoidalMap)
28import Data.Map.Monoidal (MonoidalMap)
29import qualified Data.Map.Monoidal as MonoidalMap
29import qualified Data.Map.Monoidal as MonoidalMap
30−import Data.Semigroup
30+import Data.Semigroup (Semigroup(..))
31import Foreign.Storable
31import Foreign.Storable
32
32
33import Reflex.Class
33import Reflex.Class
src/Reflex/Time.hs+1−1
@@ -33,7 +33,7 @@ import Control.Monad.IO.Class
33import Data.Align
33import Data.Align
34import Data.Data (Data)
34import Data.Data (Data)
35import Data.Fixed
35import Data.Fixed
36−import Data.Semigroup
36+import Data.Semigroup (Semigroup(..))
37import Data.Sequence (Seq, (|>))
37import Data.Sequence (Seq, (|>))
38import qualified Data.Sequence as Seq
38import qualified Data.Sequence as Seq
39import Data.These
39import Data.These