on develop help sign in
Rename MonadDynamicWriter
767faa1Ali Abrar
ChangeLog.md+1
@@ -3,6 +3,7 @@
3## 0.6.0.0 -- 2019-03-20
3## 0.6.0.0 -- 2019-03-20
4
4
5* Deprecate FunctorMaybe in favor of Data.Witherable.Filterable. We still export fmapMaybe, ffilter, etc., but they all rely on Filterable now.
5* Deprecate FunctorMaybe in favor of Data.Witherable.Filterable. We still export fmapMaybe, ffilter, etc., but they all rely on Filterable now.
6+* Rename MonadDynamicWriter to DynamicWriter and add a deprecation for the old name.
6* Remove many deprecated functions
7* Remove many deprecated functions
7* Add a Num instance for Dynamic
8* Add a Num instance for Dynamic
8* Add matchRequestsWithResponses to make it easier to use Requester with protocols that don't do this matching for you
9* Add matchRequestsWithResponses to make it easier to use Requester with protocols that don't do this matching for you
src/Reflex/DynamicWriter/Base.hs+2−2
@@ -88,7 +88,7 @@ mergeDynIncrementalWithMove a = unsafeBuildIncremental (mapM (sample . current)
88 noLongerMovedMap = Map.fromList $ fmap (, ()) noLongerMoved
88 noLongerMovedMap = Map.fromList $ fmap (, ()) noLongerMoved
89 in Map.differenceWith (\e _ -> Just $ MapWithMove.nodeInfoSetTo Nothing e) pWithNewVals noLongerMovedMap --TODO: Check if any in the second map are not covered?
89 in Map.differenceWith (\e _ -> Just $ MapWithMove.nodeInfoSetTo Nothing e) pWithNewVals noLongerMovedMap --TODO: Check if any in the second map are not covered?
90
90
91−-- | A basic implementation of 'MonadDynamicWriter'.
91+-- | A basic implementation of 'DynamicWriter'.
92newtype DynamicWriterT t w m a = DynamicWriterT { unDynamicWriterT :: StateT [Dynamic t w] m a }
92newtype DynamicWriterT t w m a = DynamicWriterT { unDynamicWriterT :: StateT [Dynamic t w] m a }
93 deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order
93 deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order
94
94
@@ -116,7 +116,7 @@ runDynamicWriterT (DynamicWriterT a) = do
116 (result, ws) <- runStateT a []
116 (result, ws) <- runStateT a []
117 return (result, mconcat $ reverse ws)
117 return (result, mconcat $ reverse ws)
118
118
119−instance (Monad m, Monoid w, Reflex t) => MonadDynamicWriter t w (DynamicWriterT t w m) where
119+instance (Monad m, Monoid w, Reflex t) => DynamicWriter t w (DynamicWriterT t w m) where
120 tellDyn w = DynamicWriterT $ modify (w :)
120 tellDyn w = DynamicWriterT $ modify (w :)
121
121
122instance MonadReader r m => MonadReader r (DynamicWriterT t w m) where
122instance MonadReader r m => MonadReader r (DynamicWriterT t w m) where
src/Reflex/DynamicWriter/Class.hs+9−4
@@ -1,4 +1,5 @@
1−-- | This module defines the 'MonadDynamicWriter' class.
1+-- | This module defines the 'DynamicWriter' class.
2+{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE CPP #-}
3{-# LANGUAGE CPP #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FunctionalDependencies #-}
5{-# LANGUAGE FunctionalDependencies #-}
@@ -8,17 +9,21 @@
8{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
9{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
9#endif
10#endif
10module Reflex.DynamicWriter.Class
11module Reflex.DynamicWriter.Class
11− ( MonadDynamicWriter (..)
12+ ( MonadDynamicWriter
13+ , DynamicWriter(..)
12 ) where
14 ) where
13
15
14import Control.Monad.Reader (ReaderT, lift)
16import Control.Monad.Reader (ReaderT, lift)
15import Reflex.Class (Dynamic)
17import Reflex.Class (Dynamic)
16
18
19+{-# DEPRECATED MonadDynamicWriter "Use 'DynamicWriter' instead" #-}
20+type MonadDynamicWriter = DynamicWriter
21+
17-- | 'MonadDynamicWriter' efficiently collects 'Dynamic' values using 'tellDyn'
22-- | 'MonadDynamicWriter' efficiently collects 'Dynamic' values using 'tellDyn'
18-- and combines them monoidally to provide a 'Dynamic' result.
23-- and combines them monoidally to provide a 'Dynamic' result.
19−class (Monad m, Monoid w) => MonadDynamicWriter t w m | m -> t w where
24+class (Monad m, Monoid w) => DynamicWriter t w m | m -> t w where
20 tellDyn :: Dynamic t w -> m ()
25 tellDyn :: Dynamic t w -> m ()
21
26
22−instance MonadDynamicWriter t w m => MonadDynamicWriter t w (ReaderT r m) where
27+instance DynamicWriter t w m => DynamicWriter t w (ReaderT r m) where
23 tellDyn = lift . tellDyn
28 tellDyn = lift . tellDyn
24
29
src/Reflex/EventWriter/Base.hs+2−2
@@ -25,7 +25,7 @@ module Reflex.EventWriter.Base
25import Reflex.Adjustable.Class
25import Reflex.Adjustable.Class
26import Reflex.Class
26import Reflex.Class
27import Reflex.EventWriter.Class (EventWriter, tellEvent)
27import Reflex.EventWriter.Class (EventWriter, tellEvent)
28−import Reflex.DynamicWriter.Class (MonadDynamicWriter, tellDyn)
28+import Reflex.DynamicWriter.Class (DynamicWriter, tellDyn)
29import Reflex.Host.Class
29import Reflex.Host.Class
30import Reflex.PerformEvent.Class
30import Reflex.PerformEvent.Class
31import Reflex.PostBuild.Class
31import Reflex.PostBuild.Class
@@ -278,7 +278,7 @@ instance (MonadQuery t q m, Monad m) => MonadQuery t q (EventWriterT t w m) wher
278 askQueryResult = lift askQueryResult
278 askQueryResult = lift askQueryResult
279 queryIncremental = lift . queryIncremental
279 queryIncremental = lift . queryIncremental
280
280
281−instance MonadDynamicWriter t w m => MonadDynamicWriter t w (EventWriterT t v m) where
281+instance DynamicWriter t w m => DynamicWriter t w (EventWriterT t v m) where
282 tellDyn = lift . tellDyn
282 tellDyn = lift . tellDyn
283
283
284instance PrimMonad m => PrimMonad (EventWriterT t w m) where
284instance PrimMonad m => PrimMonad (EventWriterT t w m) where
src/Reflex/Query/Base.hs+1−1
@@ -340,5 +340,5 @@ instance Requester t m => Requester t (QueryT t q m) where
340instance EventWriter t w m => EventWriter t w (QueryT t q m) where
340instance EventWriter t w m => EventWriter t w (QueryT t q m) where
341 tellEvent = lift . tellEvent
341 tellEvent = lift . tellEvent
342
342
343−instance MonadDynamicWriter t w m => MonadDynamicWriter t w (QueryT t q m) where
343+instance DynamicWriter t w m => DynamicWriter t w (QueryT t q m) where
344 tellDyn = lift . tellDyn
344 tellDyn = lift . tellDyn