on develop help sign in
Merge pull request #321 from alexfmpe/ae-relax-constraints

Relax constraints on dyn/widgetHold

commitacc5035683b55782bc5e290d017de94f4a0c3291 authorAli Abrar <aliabrar@gmail.com> dateWed 13 Nov 2019, 20:20 (7 years ago) parentf4735797eb1ef6
2 files changed+6−4
reflex-dom-core/ChangeLog.md+1 reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+5−4
reflex-dom-core/ChangeLog.md+1
@@ -8,6 +8,7 @@
88* Reintroduce "data-ssr": elements without this attribute are skipped during
99 hydration.
1010* Fix an issue in the hydration tests that prevented the test from finding the chromium executable
11+* Relax constraints on `dyn` and `widgetHold` to match the ones in `networkView` and `networkHold` respectively
1112
1213## 0.5.1
1314
reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+5−4
@@ -60,6 +60,7 @@ module Reflex.Dom.Widget.Basic
6060 , partitionMapBySetLT
6161 ) where
6262
63+import Reflex.Adjustable.Class
6364import Reflex.Class
6465import Reflex.Collection
6566import Reflex.Dom.Builder.Class
@@ -146,21 +147,21 @@ button t = do
146147-- | Given a Dynamic of widget-creating actions, create a widget that is recreated whenever the Dynamic updates.
147148-- The returned Event of widget results occurs when the Dynamic does.
148149-- Note: Often, the type @a@ is an 'Event', in which case the return value is an Event-of-Events that would typically be flattened (via 'switchHold').
149−dyn :: (DomBuilder t m, PostBuild t m) => Dynamic t (m a) -> m (Event t a)
150+dyn :: (Adjustable t m, NotReady t m, PostBuild t m) => Dynamic t (m a) -> m (Event t a)
150151dyn = networkView
151152
152153-- | Like 'dyn' but discards result.
153−dyn_ :: (DomBuilder t m, PostBuild t m) => Dynamic t (m a) -> m ()
154+dyn_ :: (Adjustable t m, NotReady t m, PostBuild t m) => Dynamic t (m a) -> m ()
154155dyn_ = void . dyn
155156
156157-- | Given an initial widget and an Event of widget-creating actions, create a widget that is recreated whenever the Event fires.
157158-- The returned Dynamic of widget results occurs when the Event does.
158159-- Note: Often, the type 'a' is an Event, in which case the return value is a Dynamic-of-Events that would typically be flattened (via 'switchDyn').
159−widgetHold :: (DomBuilder t m, MonadHold t m) => m a -> Event t (m a) -> m (Dynamic t a)
160+widgetHold :: (Adjustable t m, MonadHold t m) => m a -> Event t (m a) -> m (Dynamic t a)
160161widgetHold = networkHold
161162
162163-- | Like 'widgetHold' but discards result.
163−widgetHold_ :: (DomBuilder t m, MonadHold t m) => m a -> Event t (m a) -> m ()
164+widgetHold_ :: (Adjustable t m, MonadHold t m) => m a -> Event t (m a) -> m ()
164165widgetHold_ z = void . widgetHold z
165166
166167-- | Create a DOM element