Module

React.Halo.Internal.Control

#HaloF

data HaloF props ctx state action (m :: Type -> Type) a

The Halo evaluation algebra

  • props are the component props
  • ctx is some component context
  • state is the component state
  • action is the set of actions that the component handles
  • m is the monad used during evaluation
  • a is the result type

Constructors

Instances

#HaloM

newtype HaloM props ctx state action (m :: Type -> Type) a

The Halo evaluation monad. It lifts the HaloF algebra into a free monad.

  • props are the component props
  • ctx is some component context
  • state is the component state
  • action is the set of actions that the component handles
  • m is the monad used during evaluation
  • a is the result type

Constructors

Instances

#HaloAp

newtype HaloAp props ctx state action (m :: Type -> Type) a

The Halo parallel evaluation applicative. It lifts HaloM into a free applicative.

  • props are the component props
  • ctx is some component context
  • state is the component state
  • action is the set of actions that the component handles
  • m is the monad used during evaluation
  • a is the result type

Constructors

Instances

#hoist

hoist :: forall props ctx state action m m'. Functor m => (m ~> m') -> (HaloM props ctx state action m) ~> (HaloM props ctx state action m')

Hoist (transform) the base monad of a HaloM expression.

#hoistAp

hoistAp :: forall props ctx state action m m'. Functor m => (m ~> m') -> (HaloAp props ctx state action m) ~> (HaloAp props ctx state action m')

Hoist (transform) the base applicative of a HaloAp expression.

#props

props :: forall props ctx state action m. HaloM props ctx state action m props

Read the current props.

#context

context :: forall props ctx state action m. HaloM props ctx state action m ctx

Read the current context.

#subscribe

subscribe :: forall props ctx state action m. Emitter action -> HaloM props ctx state action m SubscriptionId

Subscribe to new actions from an Emitter. Subscriptions will be automatically cancelled when the component unmounts.

Returns a SubscriptionId which can be used with unsubscribe to manually cancel a subscription.

#subscribe'

subscribe' :: forall props ctx state action m. (SubscriptionId -> Emitter action) -> HaloM props ctx state action m SubscriptionId

Same as subscribe but the event-producing logic is also passed the SuscriptionId. This is useful when events need to unsubscribe themselves.

#unsubscribe

unsubscribe :: forall props ctx state action m. SubscriptionId -> HaloM props ctx state action m Unit

Cancels the event subscription belonging to the SubscriptionId.

#fork

fork :: forall props ctx state action m. HaloM props ctx state action m Unit -> HaloM props ctx state action m ForkId

Start a HaloM process running independantly from the current "thread". Forks are tracked automatically and killed when the Finalize event occurs (when the component unmounts). New forks can still be created during the Finalize event, but once evaluation ends there will be no way of killing them.

Returns a ForkId for the new process.

#kill

kill :: forall props ctx state action m. ForkId -> HaloM props ctx state action m Unit

Kills the process belonging to the ForkId.

Modules