Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflex.Network: improve haddocks #500

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading