Skip to content

Commit

Permalink
Merge pull request #500 from endgame/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-abrar authored Jun 12, 2024
2 parents e698e13 + 62c5902 commit ccc8208
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Reflex/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import Reflex.PostBuild.Class
-- | A 'Dynamic' "network": Takes a 'Dynamic' of network-creating actions and replaces the network whenever the 'Dynamic' updates.
-- The returned Event of network results fires at post-build time and when the 'Dynamic' updates.
-- Note: Often, the type 'a' is an Event, in which case the return value is an Event-of-Events, where the outer 'Event' fires
-- when switching networks. Such an 'Event' would typically be flattened (via 'switchPromptly').
-- when switching networks. Such an 'Event' would typically be flattened (via 'switchHoldPromptly').
networkView :: (NotReady t m, Adjustable t m, PostBuild t m) => Dynamic t (m a) -> m (Event t a)
networkView child = do
postBuild <- getPostBuild
let newChild = leftmost [updated child, tagCheap (current child) postBuild]
snd <$> runWithReplace notReady newChild

-- | Given an initial "network" and an 'Event' of network-creating actions, create a network that is recreated whenever the Event fires.
-- The returned Dynamic of network results occurs when the Event does.
-- Note: Often, the type 'a' is an Event, in which case the return value is a Dynamic-of-Events that would typically be flattened.
-- The returned Dynamic of network results occurs when the Event does.
-- 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 'switchPromptlyDyn').
networkHold :: (Adjustable t m, MonadHold t m) => m a -> Event t (m a) -> m (Dynamic t a)
networkHold child0 newChild = do
(result0, newResult) <- runWithReplace child0 newChild
Expand Down

0 comments on commit ccc8208

Please sign in to comment.