Module

Spork.EventQueue

#Loop

data Loop m i

Constructors

#EventQueue

type EventQueue m i o = EventQueueInstance m o -> m (Loop m i)

#EventQueueAccum

type EventQueueAccum m s i = { commit :: s -> m s, init :: s, update :: s -> i -> m s }

#EventQueueInstance

type EventQueueInstance m o = { push :: o -> m Unit, run :: m Unit }

#stepper

stepper :: forall m i o. Monad m => (i -> m o) -> EventQueue m i o

Creates an EventQueue from a Kleisli arrow.

#withCont

withCont :: forall m i o. Applicative m => (EventQueueInstance m o -> i -> m Unit) -> EventQueue m i o

Creates an EventQueue which performs an action on every input.

#withAccum

withAccum :: forall m s i o. Applicative m => (EventQueueInstance m o -> m (EventQueueAccum m s i)) -> EventQueue m i o

Creates an EventQueue with an EventQueueAccum lifecycle.

#withAccumArray

withAccumArray :: forall m i o. Applicative m => (EventQueueInstance m o -> m (Array i -> m Unit)) -> EventQueue m i o

Creates an EventQueue comprised of only a commit action for inputs buffered in an Array.

#fix

fix :: forall i. EventQueue Effect i i -> Effect (EventQueueInstance Effect i)

Creates an EventQueue that can feed back into itself.

Modules