# Halogen.Component

- Package
- purescript-halogen
- Repository
- slamdata/purescript-halogen

### #Component Source

`data Component (h :: Type -> Type -> Type) (f :: Type -> Type) i o (m :: Type -> Type)`

The "public" type for a component, with details of the component internals existentially hidden.

`h`

is the type that will be rendered by the component, usually`HTML`

`f`

is the query algebra`i`

is the input value type that will be mapped to an`f`

whenever the parent of this component renders`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #Component' Source

`type Component' h s f g p i o m = { eval :: f ~> (HalogenM s f g p o m), finalizer :: Maybe (f Unit), initialState :: i -> s, initializer :: Maybe (f Unit), mkOrdBox :: p -> OrdBox p, receiver :: i -> Maybe (f Unit), render :: s -> h (ComponentSlot h g m p (f Unit)) (f Unit) }`

The "private" type for a component.

`h`

is the type that will be rendered by the component, usually`HTML`

`s`

is the component's state`f`

is the query algebra for the component itself`g`

is the query algebra for child components`p`

is the slot type for addressing child components`i`

is the input value type that will be mapped to an`f`

whenever the parent of this component renders`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #mkComponent Source

`mkComponent :: forall h s f g p i o m. Component' h s f g p i o m -> Component h f i o m`

Makes a `Component`

from a `Component'`

, existentially hiding details about
the component's state and potential children.

### #unComponent Source

`unComponent :: forall h f i o m r. (forall s g p. Component' h s f g p i o m -> r) -> Component h f i o m -> r`

Exposes the inner details of a component to a function to produce a new result. The inner details will not be allowed to be revealed in the result of the function - the compiler will complain about an escaped skolem.

### #ComponentSpec Source

`type ComponentSpec h s f i o m = { eval :: f ~> (ComponentDSL s f o m), initialState :: i -> s, receiver :: i -> Maybe (f Unit), render :: s -> h Void (f Unit) }`

A spec for a component with no possible children.

`h`

is the type that will be rendered by the component, usually`HTML`

`s`

is the component's state`f`

is the query algebra`i`

is the input value type that will be mapped to an`f`

whenever the parent of this component renders`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #ComponentHTML Source

`type ComponentHTML f = HTML Void (f Unit)`

A convenience synonym for the output type of a `render`

function, for a
childless component that renders HTML.

### #ComponentDSL Source

`type ComponentDSL s f = HalogenM s f (Const Void) Void`

A synonym for `HalogenM`

with some type parameters populated that are not
relevant for childless components.

### #component Source

`component :: forall h s f i o m. Bifunctor h => ComponentSpec h s f i o m -> Component h f i o m`

Builds a component with no possible children.

### #LifecycleComponentSpec Source

`type LifecycleComponentSpec h s f i o m = { eval :: f ~> (ComponentDSL s f o m), finalizer :: Maybe (f Unit), initialState :: i -> s, initializer :: Maybe (f Unit), receiver :: i -> Maybe (f Unit), render :: s -> h Void (f Unit) }`

A spec for a component with no possible children, including lifecycle inputs.

`h`

is the type that will be rendered by the component, usually`HTML`

`s`

is the component's state`f`

is the query algebra`i`

is the input value type that will be mapped to an`f`

whenever the parent of this component renders`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #lifecycleComponent Source

`lifecycleComponent :: forall h s f i o m. Bifunctor h => LifecycleComponentSpec h s f i o m -> Component h f i o m`

Builds a component with lifecycle inputs and no possible children.

### #ParentComponentSpec Source

`type ParentComponentSpec h s f g p i o m = { eval :: f ~> (HalogenM s f g p o m), initialState :: i -> s, receiver :: i -> Maybe (f Unit), render :: s -> h (ComponentSlot h g m p (f Unit)) (f Unit) }`

A spec for a component.

`h`

is the type that will be rendered by the component, usually`HTML`

`s`

is the component's state`f`

is the query algebra for the component itself`g`

is the query algebra for child components`p`

is the slot type for addressing child components`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #parentComponent Source

`parentComponent :: forall h s f g p i o m. Ord p => ParentComponentSpec h s f g p i o m -> Component h f i o m`

Builds a component that allows for children.

### #ParentHTML Source

`type ParentHTML f g p m = HTML (ComponentSlot HTML g m p (f Unit)) (f Unit)`

A convenience synonym for the output type of a `render`

function, for a
parent component that renders HTML.

### #ParentLifecycleComponentSpec Source

`type ParentLifecycleComponentSpec h s f g p i o m = { eval :: f ~> (HalogenM s f g p o m), finalizer :: Maybe (f Unit), initialState :: i -> s, initializer :: Maybe (f Unit), receiver :: i -> Maybe (f Unit), render :: s -> h (ComponentSlot h g m p (f Unit)) (f Unit) }`

A spec for a parent component, including lifecycle inputs.

`h`

is the type that will be rendered by the component, usually`HTML`

`s`

is the component's state`f`

is the query algebra for the component itself`g`

is the query algebra for child components`p`

is the slot type for addressing child components`o`

is the type for the component's output messages`m`

is the monad used for non-component-state effects

### #lifecycleParentComponent Source

`lifecycleParentComponent :: forall h s f g p i o m. Ord p => ParentLifecycleComponentSpec h s f g p i o m -> Component h f i o m`

Builds a component with lifecycle inputs that allows for children.

### #ComponentSlot Source

`data ComponentSlot (h :: Type -> Type -> Type) (g :: Type -> Type) (m :: Type -> Type) p q`

#### Instances

`Bifunctor (ComponentSlot h g m)`

`Functor (ComponentSlot h g m p)`

### #mkComponentSlot Source

`mkComponentSlot :: forall h g z m p j q o. p -> (Component h z j o m) -> j -> (j -> Maybe (g Unit)) -> (o -> Maybe q) -> (forall x. g x -> Maybe (z x)) -> ComponentSlot h g m p q`

### #unComponentSlot Source

`unComponentSlot :: forall h g m p q r. (forall z j o. p -> Component h z j o m -> j -> (j -> Maybe (g Unit)) -> (o -> Maybe q) -> (forall x. g x -> Maybe (z x)) -> r) -> ComponentSlot h g m p q -> r`

### #hoistSlot Source

`hoistSlot :: forall h g m m' p q. Bifunctor h => Functor m' => (m ~> m') -> ComponentSlot h g m p q -> ComponentSlot h g m' p q`

- Modules
- Halogen
- Halogen.
Aff - Halogen.
Aff. Driver - Halogen.
Aff. Driver. Eval - Halogen.
Aff. Driver. State - Halogen.
Aff. Util - Halogen.
Component - Halogen.
Component. ChildPath - Halogen.
Component. Profunctor - Halogen.
Data. OrdBox - Halogen.
Data. Prism - Halogen.
HTML - Halogen.
HTML. Core - Halogen.
HTML. Elements - Halogen.
HTML. Elements. Keyed - Halogen.
HTML. Events - Halogen.
HTML. Properties - Halogen.
HTML. Properties. ARIA - Halogen.
Query - Halogen.
Query. EventSource - Halogen.
Query. ForkF - Halogen.
Query. HalogenM - Halogen.
Query. InputF - Halogen.
VDom. Driver