reflex-potatoes-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Reflex.Potato.Helpers

Synopsis

Documentation

dsum_to_dmap :: GCompare k => DSum k f -> DMap k f Source #

simultaneous :: Reflex t => Event t a -> Event t b -> Event t (a, b) Source #

fires only when both events fire

assertEvent Source #

Arguments

:: (Reflex t, Show a) 
=> String

assert message

-> (a -> Bool)

predicate to check

-> Event t a 
-> Event t a 

assert that a predicate is true each time the event triggers

assertEventWith Source #

Arguments

:: Reflex t 
=> (a -> String)

assert message

-> (a -> Bool)

predicate to check

-> Event t a 
-> Event t a 

assert that a predicate is true each time the event triggers

fmapMaybeWarn Source #

Arguments

:: (Reflex t, Show a) 
=> String

warning message

-> (a -> Bool)

predicate to check

-> Event t a 
-> Event t a 

same as fmapMaybe except outputs a warning if predicate fails

fmapMaybeWarnWith Source #

Arguments

:: Reflex t 
=> (a -> String)

warning message

-> (a -> Bool)

predicate to check

-> Event t a 
-> Event t a 

same as fmapMaybe except outputs a warning if predicate fails

leftmostWarn :: Reflex t => String -> [Event t a] -> Event t a Source #

same as leftmost but outputs a warning if more than one event fires at once

leftmostAssert :: Reflex t => String -> [Event t a] -> Event t a Source #

same as leftmost but asserts if more than one event fires at once

leftmostWarnWithIndex :: Reflex t => String -> [Event t a] -> Event t a Source #

same as leftmostWarn but also adds an index for debugging

leftmostWarnWithEverything :: (Reflex t, Show a) => String -> [Event t a] -> Event t a Source #

same as leftmostWarn but rpint everything

alignWarn :: Reflex t => String -> Event t a -> Event t b -> Event t (Either a b) Source #

same as align but only returns left event if both events fire prints a warning if both events fire

alignAssert :: Reflex t => String -> Event t a -> Event t b -> Event t (Either a b) Source #

same as align but returns an either and asserts if both events fire at once

foldDynMergeWith Source #

Arguments

:: (Reflex t, MonadHold t m, MonadFix m) 
=> b

initial value of dynamic

-> [Event t (b -> b)]

list of events producing a reducing method

-> m (Dynamic t b)

final output after all folding methods applied

foldDynMerge Source #

Arguments

:: (Reflex t, MonadHold t m, MonadFix m) 
=> (a -> b -> b)

folding method

-> b

initial value of dynamic

-> [Event t a]

list of events

-> m (Dynamic t b)

final output

fanDSum :: forall t k. (Reflex t, GCompare k) => Event t (DSum k Identity) -> EventSelector t k Source #

pushAlwaysDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> PushM t b) -> Dynamic t a -> m (Dynamic t b) Source #

delayEvent :: forall t m a. Adjustable t m => Event t a -> m (Event t a) Source #

delays an event by 1 tick

sequenceEvents :: forall t m a b. (Adjustable t m, MonadFix m) => Event t a -> Event t b -> m (Event t b) Source #

This takes two possibly simultaneous events to and sequences them to fire on different frames. If both events fire at the same time, this functions returns an event with the second event's results that fires one frame after the first event fires.

stepEvents :: forall t m a. (Adjustable t m, MonadFix m) => Event t [a] -> m (Event t a) Source #

Creates an output event that fires once for each input in the list. Each output event runs in a different consecutive frame. If an output event triggers the input event, they get appended to the end of the list of events to be triggered

stepEventsAndCollectOutput Source #

Arguments

:: forall t m a b. (Adjustable t m, MonadHold t m, MonadFix m) 
=> Event t [a]

event to repeat

-> Event t b

event to collect results from, only collects if event fires

-> m (Event t a, Event t [b])

(repeated event, collected results once event is done repeating)

Same as stepEvents but collects results for each event firing.

stepEventsAndSequenceCollectOutput Source #

Arguments

:: forall t m a b. (Adjustable t m, MonadHold t m, MonadFix m) 
=> Event t [a]

event to step

-> Event t b

event to collect results from, only collects if event fires

-> m (Event t a, Event t [b])

(repeated event, collected results once event is done repeating)

Same as stepEventsAndCollectOutput but the collected event fires one frame AFTER the last input event fires

switchHoldPair :: (Reflex t, MonadHold t m) => Event t a -> Event t b -> Event t (Event t a, Event t b) -> m (Event t a, Event t b) Source #

switchHoldTriple :: forall t m a b c. (Reflex t, MonadHold t m) => Event t a -> Event t b -> Event t c -> Event t (Event t a, Event t b, Event t c) -> m (Event t a, Event t b, Event t c) Source #

waitForSecondAfterFirst :: (Reflex t, MonadFix m, MonadHold t m) => Event t a -> Event t b -> m (Event t (a, b)) Source #

produces an event that will fire when the following sequence of conditions happens or happens simultaneously evA fires evB fires

the state is reset after this event fires and the sequence must occur again for the event to fire again