on develop help sign in
Added Semigroup instance for Dynamic.
eb67935Robert Klotzner
src/Reflex/Class.hs+8
@@ -911,6 +911,14 @@ zipDynWith f da db =
911 return $ Just $ f a b
911 return $ Just $ f a b
912 in unsafeBuildDynamic (f <$> sample (current da) <*> sample (current db)) ec
912 in unsafeBuildDynamic (f <$> sample (current da) <*> sample (current db)) ec
913
913
914+instance (Reflex t, Semigroup a) => Semigroup (Dynamic t a) where
915+ (<>) = zipDynWith (<>)
916+#if MIN_VERSION_semigroups(0,17,0)
917+ stimes n = fmap $ stimes n
918+#else
919+ times1p n = fmap $ times1p n
920+#endif
921+
914instance (Reflex t, Monoid a) => Monoid (Dynamic t a) where
922instance (Reflex t, Monoid a) => Monoid (Dynamic t a) where
915 mconcat = distributeListOverDynWith mconcat
923 mconcat = distributeListOverDynWith mconcat
916 mempty = constDyn mempty
924 mempty = constDyn mempty