on develop help sign in
Added Semigroup instance for Dynamic.
commiteb67935b2b602ea04fbbc5a7647db7565155521e authorRobert Klotzner <robert.klotzner@gmx.at> dateThu 15 Feb 2018, 10:38 (9 years ago) parentc2b8ccd
1 file changed+8
src/Reflex/Class.hs+8
src/Reflex/Class.hs+8
@@ -911,6 +911,14 @@ zipDynWith f da db =
911911 return $ Just $ f a b
912912 in unsafeBuildDynamic (f <$> sample (current da) <*> sample (current db)) ec
913913
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+
914922instance (Reflex t, Monoid a) => Monoid (Dynamic t a) where
915923 mconcat = distributeListOverDynWith mconcat
916924 mempty = constDyn mempty