@@ -53,10 +53,12 @@ module Reflex.Dynamic
5353 , foldDynMaybe
5454 , foldDynMaybeM
5555 , joinDynThroughMap
56+ , joinDynThroughIntMap
5657 , traceDyn
5758 , traceDynWith
5859 , splitDynPure
5960 , distributeMapOverDynPure
61+ , distributeIntMapOverDynPure
6062 , distributeDMapOverDynPure
6163 , distributeListOverDynPure
6264 , Demux
@@ -88,6 +90,8 @@ import Data.Dependent.Map (DMap)
8890import qualified Data.Dependent.Map as DMap
8991import Data.Dependent.Sum (DSum (..))
9092import Data.GADT.Compare (GCompare (..), GEq (..), GOrdering (..))
93+import Data.IntMap (IntMap)
94+import qualified Data.IntMap as IntMap
9195import Data.Map (Map)
9296import Data.Maybe
9397import Data.Monoid ((<>))
@@ -202,6 +206,11 @@ splitDynPure d = (fmap fst d, fmap snd d)
202206distributeMapOverDynPure :: (Reflex t, Ord k) => Map k (Dynamic t v) -> Dynamic t (Map k v)
203207distributeMapOverDynPure = fmap dmapToMap . distributeDMapOverDynPure . mapWithFunctorToDMap
204208
209+-- | Convert an 'IntMap' with 'Dynamic' elements into a 'Dynamic' of an 'IntMap' with
210+-- non-'Dynamic' elements.
211+distributeIntMapOverDynPure :: (Reflex t) => IntMap (Dynamic t v) -> Dynamic t (IntMap v)
212+distributeIntMapOverDynPure = fmap dmapToIntMap . distributeDMapOverDynPure . intMapWithFunctorToDMap
213+
205214-- | Convert a list with 'Dynamic' elements into a 'Dynamic' of a list with
206215-- non-'Dynamic' elements, preserving the order of the elements.
207216{-# DEPRECATED distributeListOverDynPure "Use 'distributeListOverDyn' instead" #-}
@@ -214,6 +223,11 @@ distributeListOverDynPure = distributeListOverDyn
214223joinDynThroughMap :: forall t k a. (Reflex t, Ord k) => Dynamic t (Map k (Dynamic t a)) -> Dynamic t (Map k a)
215224joinDynThroughMap = (distributeMapOverDynPure =<<)
216225
226+-- | Combine a 'Dynamic' of an 'IntMap' of 'Dynamic's into a 'Dynamic'
227+-- with the current values of the 'Dynamic's in a map.
228+joinDynThroughIntMap :: forall t a. (Reflex t) => Dynamic t (IntMap (Dynamic t a)) -> Dynamic t (IntMap a)
229+joinDynThroughIntMap = (distributeIntMapOverDynPure =<<)
230+
217231-- | Print the value of the 'Dynamic' when it is first read and on each
218232-- subsequent change that is observed (as 'traceEvent'), prefixed with the
219233-- provided string. This should /only/ be used for debugging.