Module

Spork.EventQueue

Package
purescript-spork
Repository
natefaubion/purescript-spork

#Loop Source

data Loop m i

Constructors

#EventQueue Source

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

#EventQueueAccum Source

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

#EventQueueInstance Source

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

#QueueEffects Source

type QueueEffects eff = (ref :: REF | eff)

#stepper Source

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

Creates an EventQueue from a Kleisli arrow.

#withCont Source

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

Creates an EventQueue which performs an action on every input.

#withAccum Source

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

Creates an EventQueue with an EventQueueAccum lifecycle.

#withAccumArray Source

withAccumArray :: forall o i m. 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 Source

fix :: forall i eff. EventQueue (Eff (QueueEffects eff)) i i -> Eff (QueueEffects eff) (EventQueueInstance (Eff (QueueEffects eff)) i)

Creates an EventQueue that can feed back into itself.