Module

Yoga.Om.Rom

Package
purescript-yoga-om-rom
Repository
rowtype-yoga/purescript-yoga-om-rom

#omToEvent Source

omToEvent :: forall ctx r rl err_ err a. RowToList (exception :: Error -> Aff a | r) rl => VariantMatchCases rl err_ (Aff a) => Union err_ () (exception :: Error | err) => ctx -> { exception :: Error -> Aff a | r } -> Om ctx err a -> Event a

Convert an Om computation to a Hyrule Event The event fires once when the Om completes successfully Errors are handled by the provided error handler in the context

#eventToOm Source

eventToOm :: forall ctx err a. Event a -> Om ctx err a

Convert a Hyrule Event stream to an Om computation Takes the first value emitted by the event

#streamOms Source

streamOms :: forall ctx r rl err_ err a. RowToList (exception :: Error -> Aff a | r) rl => VariantMatchCases rl err_ (Aff a) => Union err_ () (exception :: Error | err) => ctx -> { exception :: Error -> Aff a | r } -> Array (Om ctx err a) -> Event a

Stream multiple Om computations as events Creates an event that fires for each Om that completes

#raceEvents Source

raceEvents :: forall a. Array (Event a) -> Event a

Race multiple events, taking the first successful one Similar to Om's race but for events

#filterMapOm Source

filterMapOm :: forall ctx r rl err_ err a b. RowToList (exception :: Error -> Aff (Maybe b) | r) rl => VariantMatchCases rl err_ (Aff (Maybe b)) => Union err_ () (exception :: Error | err) => (a -> Om ctx err (Maybe b)) -> ctx -> { exception :: Error -> Aff (Maybe b) | r } -> Event a -> Event b

Filter and map an Om computation based on event values

#foldOms Source

foldOms :: forall ctx r rl err_ err a b. RowToList (exception :: Error -> Aff b | r) rl => VariantMatchCases rl err_ (Aff b) => Union err_ () (exception :: Error | err) => (b -> a -> Om ctx err b) -> b -> ctx -> { exception :: Error -> Aff b | r } -> Event a -> Event b

Fold over Om computations triggered by events

#EventOmCanceller Source

type EventOmCanceller = Effect Unit

A canceller for event-based Om operations

#withEventStream Source

withEventStream :: forall ctx err a b. Event a -> (a -> Om ctx err b) -> Om ctx err (Event b)

Helper to work with event streams within an Om context Provides a clean way to integrate event-driven logic