Halogen
- Package
- purescript-halogen
- Repository
- slamdata/purescript-halogen
The base Halogen module re-exports most of the library's useful types and
combinators, aside from the HTML-building functionality - the HTML
modules export a large number of commonly named values that are likely to
conflict.
#HalogenIO Source
type HalogenIO f o m = { query :: f ~> m, subscribe :: Consumer o m Unit -> m Unit }A record produced when the root component in a Halogen UI has been run.
query allows external sources to query the root component and subscribe
allows external consumers to receive messages raised by the root component.
Re-exports from Data.Lazy 
Re-exports from Halogen.Component 
#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.
- his the type that will be rendered by the component, usually- HTML
- sis the component's state
- fis the query algebra for the component itself
- gis the query algebra for child components
- pis the slot type for addressing child components
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#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.
#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.
- his the type that will be rendered by the component, usually- HTML
- sis the component's state
- fis the query algebra for the component itself
- gis the query algebra for child components
- pis the slot type for addressing child components
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#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.
- his the type that will be rendered by the component, usually- HTML
- sis the component's state
- fis the query algebra
- iis the input value type that will be mapped to an- fwhenever the parent of this component renders
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#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.
- his the type that will be rendered by the component, usually- HTML
- sis the component's state
- fis the query algebra
- iis the input value type that will be mapped to an- fwhenever the parent of this component renders
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#ComponentSlot Source
data ComponentSlot (h :: Type -> Type -> Type) (g :: Type -> Type) (m :: Type -> Type) p qInstances
- Bifunctor (ComponentSlot h g m)
- Functor (ComponentSlot h g m p)
#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) VoidA synonym for HalogenM with some type parameters populated that are not
relevant for childless components.
#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.
- his the type that will be rendered by the component, usually- HTML
- sis the component's state
- fis the query algebra for the component itself
- gis the query algebra for child components
- pis the slot type for addressing child components
- iis the input value type that will be mapped to an- fwhenever the parent of this component renders
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#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.
- his the type that will be rendered by the component, usually- HTML
- fis the query algebra
- iis the input value type that will be mapped to an- fwhenever the parent of this component renders
- ois the type for the component's output messages
- mis the monad used for non-component-state effects
#unComponentSlot Source
unComponentSlot :: forall r q p m g h. (forall o j z. 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#unComponent Source
unComponent :: forall r m o i f h. (forall p g s. Component' h s f g p i o m -> r) -> Component h f i o m -> rExposes 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.
#parentComponent Source
parentComponent :: forall m o i p g f s h. Ord p => ParentComponentSpec h s f g p i o m -> Component h f i o mBuilds a component that allows for children.
#mkComponentSlot Source
mkComponentSlot :: forall o q j p m z g h. 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#mkComponent Source
mkComponent :: forall m o i p g f s h. Component' h s f g p i o m -> Component h f i o mMakes a Component from a Component', existentially hiding details about
the component's state and potential children.
#lifecycleParentComponent Source
lifecycleParentComponent :: forall m o i p g f s h. Ord p => ParentLifecycleComponentSpec h s f g p i o m -> Component h f i o mBuilds a component with lifecycle inputs that allows for children.
#lifecycleComponent Source
lifecycleComponent :: forall m o i f s h. Bifunctor h => LifecycleComponentSpec h s f i o m -> Component h f i o mBuilds a component with lifecycle inputs and no possible children.
#component Source
component :: forall m o i f s h. Bifunctor h => ComponentSpec h s f i o m -> Component h f i o mBuilds a component with no possible children.
Re-exports from Halogen.HTML.Core  
Re-exports from Halogen.Query 
#SubscribeStatus Source
data SubscribeStatusThe status of an EventSource subscription. When a query raised by an
EventSource evaluates to Done the producer will be unsubscribed from.
Constructors
Instances
#Request Source
type Request f a = (a -> a) -> f aType synonym for an "request" - a request can cause effects as well as fetching some information from a component.
In a query algebra, an action is any constructor that carries the algebra's type variable as the return value of a function. For example:
data Query a = SomeRequest (Boolean -> a)
#HalogenM Source
newtype HalogenM s (f :: Type -> Type) g p o m aConstructors
Instances
- Functor (HalogenM s f g p o m)
- Apply (HalogenM s f g p o m)
- Applicative (HalogenM s f g p o m)
- Bind (HalogenM s f g p o m)
- Monad (HalogenM s f g p o m)
- (MonadEffect m) => MonadEffect (HalogenM s f g p o m)
- (MonadAff m) => MonadAff (HalogenM s f g p o m)
- Parallel (HalogenAp s f g p o m) (HalogenM s f g p o m)
- MonadTrans (HalogenM s f g p o)
- MonadRec (HalogenM s f g p o m)
- MonadState s (HalogenM s f g p o m)
- (MonadAsk r m) => MonadAsk r (HalogenM s f g p o m)
- (MonadTell w m) => MonadTell w (HalogenM s f g p o m)
#HalogenF Source
data HalogenF s (f :: Type -> Type) g p o m aThe Halogen component algebra
Constructors
- State (s -> Tuple a s)
- Subscribe (EventSource f m) a
- Lift (m a)
- Halt String
- GetSlots (List p -> a)
- CheckSlot p (Boolean -> a)
- ChildQuery p (Coyoneda g a)
- Raise o a
- Par (HalogenAp s f g p o m a)
- Fork (Fork (HalogenM s f g p o m) a)
- GetRef RefLabel (Maybe Element -> a)
Instances
#EventSource Source
newtype EventSource f m#Action Source
type Action f = Unit -> f UnitType synonym for an "action" - An action only causes effects and has no result value.
In a query algebra, an action is any constructor that carries the algebra's type variable as a value. For example:
data Query a
  = SomeAction a
  | SomeOtherAction String a
  | NotAnAction (Boolean -> a)
Both SomeAction and SomeOtherAction have a as a value so they are
considered actions, whereas NotAnAction has a as the result of a
function so is considered to be a "request" (see below).
#subscribe Source
subscribe :: forall m o p g f s. EventSource f m -> HalogenM s f g p o m UnitProvides a way of having a component subscribe to an EventSource from
within an Eval function.
#put Source
put :: forall s m. MonadState s m => s -> m UnitSet the state.
#modify_ Source
modify_ :: forall m s. MonadState s m => (s -> s) -> m Unit#modify Source
modify :: forall m s. MonadState s m => (s -> s) -> m sModify the state by applying a function to the current state. The returned value is the new state value.
#liftEffect Source
liftEffect :: forall m a. MonadEffect m => Effect a -> m a#lift Source
lift :: forall t a m. MonadTrans t => Monad m => m a -> t m a#gets Source
gets :: forall a m s. MonadState s m => (s -> a) -> m aGet a value which depends on the current state.
#getHTMLElementRef Source
getHTMLElementRef :: forall m o p g f s. RefLabel -> HalogenM s f g p o m (Maybe HTMLElement)#get Source
get :: forall s m. MonadState s m => m sGet the current state.
#eventSource_ Source
eventSource_ :: forall m f. MonadAff m => (Effect Unit -> Effect Unit) -> f SubscribeStatus -> EventSource f mCreates an EventSource for a callback that accepts no arguments.
- The first argument is the function that attaches the listener.
- The second argument is the query to raise whenever the listener is triggered.
#eventSource Source
eventSource :: forall a m f. MonadAff m => ((a -> Effect Unit) -> Effect Unit) -> (a -> Maybe (f SubscribeStatus)) -> EventSource f mCreates an EventSource for a callback that accepts one argument.
- The first argument is the function that attaches the listener.
- The second argument is a handler that optionally produces a value in f.
- 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