Module

React.Halo.Internal.Control

Package
purescript-react-halo
Repository
robertdp/purescript-react-halo

#HaloF Source

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

The Halo evaluation algebra

  • props are the component props
  • 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 Source

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

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

  • props are the component props
  • 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 Source

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

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

  • props are the component props
  • 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 Source

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

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

#hoistAp Source

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

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

#props Source

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

Read the current props.

#subscribe Source

subscribe :: forall props state action m. Emitter action -> HaloM props 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' Source

subscribe' :: forall props state action m. (SubscriptionId -> Emitter action) -> HaloM props 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 Source

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

Cancels the event subscription belonging to the SubscriptionId.

#fork Source

fork :: forall props state action m. HaloM props state action m Unit -> HaloM props 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 Source

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

Kills the process belonging to the ForkId.