@@ -88,7 +88,6 @@ module Reflex.Class
89 -- ** Combining 'Dynamic's
89 -- ** Combining 'Dynamic's
90 , distributeDMapOverDynPure
90 , distributeDMapOverDynPure
91− , distributeDMapOverDynPureG
92 , distributeListOverDyn
91 , distributeListOverDyn
93 , distributeListOverDynWith
92 , distributeListOverDynWith
@@ -1110,21 +1109,12 @@ instance (Reflex t, Monoid a) => Monoid (Dynamic t a) where
1110-- 'Dynamic' 'DMap'. Its implementation is more efficient than doing the same
1109-- 'Dynamic' 'DMap'. Its implementation is more efficient than doing the same
1111-- through the use of multiple uses of 'zipDynWith' or 'Applicative' operators.
1110-- through the use of multiple uses of 'zipDynWith' or 'Applicative' operators.
1112distributeDMapOverDynPure :: forall t k. (Reflex t, GCompare k) => DMap k (Dynamic t) -> Dynamic t (DMap k Identity)
1111distributeDMapOverDynPure :: forall t k. (Reflex t, GCompare k) => DMap k (Dynamic t) -> Dynamic t (DMap k Identity)
1113−distributeDMapOverDynPure = distributeDMapOverDynPureG coerceDynamic
1112+distributeDMapOverDynPure dm = case DMap.toList dm of
1115−-- | This function converts a 'DMap' whose elements are 'Dynamic's into a
1116−-- 'Dynamic' 'DMap'. Its implementation is more efficient than doing the same
1117−-- through the use of multiple uses of 'zipDynWith' or 'Applicative' operators.
1118−distributeDMapOverDynPureG
1119− :: forall t k q v. (Reflex t, GCompare k)
1120− => (forall a. q a -> Dynamic t (v a))
1121− -> DMap k q -> Dynamic t (DMap k v)
1122−distributeDMapOverDynPureG nt dm = case DMap.toList dm of
1123 [] -> constDyn DMap.empty
1113 [] -> constDyn DMap.empty
1124− [k :=> v] -> DMap.singleton k <$> nt v
1114+ [k :=> v] -> fmap (DMap.singleton k . Identity) v
1126− let getInitial = DMap.traverseWithKey (\_ -> sample . current . nt) dm
1116+ let getInitial = DMap.traverseWithKey (\_ -> fmap Identity . sample . current) dm
1127− edmPre = mergeG getCompose $ DMap.map (Compose . updated . nt) dm
1117+ edmPre = merge $ DMap.map updated dm
1128 result = unsafeBuildDynamic getInitial $ flip pushAlways edmPre $ \news -> do
1118 result = unsafeBuildDynamic getInitial $ flip pushAlways edmPre $ \news -> do
1129 olds <- sample $ current result
1119 olds <- sample $ current result
1130 return $ DMap.unionWithKey (\_ _ new -> new) olds news
1120 return $ DMap.unionWithKey (\_ _ new -> new) olds news