Safe Haskell | None |
---|---|
Language | GHC2021 |
Halogen
Synopsis
- data HalogenSocket (query :: Type -> Type) output (m :: Type -> Type) = HalogenSocket {}
- data Slot (query :: Type -> Type) output slotType
- data VoidF (p :: k)
- componentSlot :: forall (label :: Symbol) -> forall (query :: Type -> Type) input output (slots :: Row Type) (m :: Type -> Type) action slot. (HasType label (Slot query output slot) slots, KnownSymbol label, Ord slot) => slot -> Component query input output m -> input -> (output -> Maybe action) -> ComponentSlotBox slots m action
- defaultEval :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). EvalSpec state query action slots input output m
- hoist :: forall (query :: Type -> Type) input output (m :: Type -> Type) (m' :: Type -> Type). Functor m' => (m ~> m') -> Component query input output m -> Component query input output m'
- mkComponent :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). ComponentSpec state query action slots input output m -> Component query input output m
- mkEval :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). EvalSpec state query action slots input output m -> HalogenQ query action input ~> HalogenM state action slots output m
- data Component (query :: Type -> Type) input output (m :: Type -> Type) = Component (ComponentSpec model query msg slots input output m)
- data ComponentSlot (slots :: Row Type) (m :: Type -> Type) msg
- data ComponentSlotBox (slots :: Row Type) (m :: Type -> Type) msg
- data ComponentSpec' state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type) (n :: Type -> Type) = ComponentSpec {
- initialState :: input -> m state
- render :: state -> HTML (ComponentSlot slots m action) action
- eval :: HalogenQ query action input ~> n
- data EvalSpec state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type) = EvalSpec {
- handleAction :: action -> HalogenM state action slots output m ()
- handleQuery :: forall a. query a -> HalogenM state action slots output m (Maybe a)
- receive :: input -> Maybe action
- initialize :: Maybe action
- finalize :: Maybe action
- type ComponentHTML action (slots :: Row Type) (m :: Type -> Type) = HTML (ComponentSlot slots m action) action
- newtype ElemName = ElemName Text
- newtype Namespace = Namespace Text
- newtype AttrName = AttrName Text
- newtype ClassName = ClassName Text
- newtype PropName (value :: k) = PropName Text
- module Halogen.Query
Documentation
componentSlot :: forall (label :: Symbol) -> forall (query :: Type -> Type) input output (slots :: Row Type) (m :: Type -> Type) action slot. (HasType label (Slot query output slot) slots, KnownSymbol label, Ord slot) => slot -> Component query input output m -> input -> (output -> Maybe action) -> ComponentSlotBox slots m action Source #
Constructs a ComponentSlot | | Takes: | - the slot address label | - the slot address index | - the component for the slot | - the input value to pass to the component | - a function mapping outputs from the component to a query in the parent
defaultEval :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). EvalSpec state query action slots input output m Source #
A default value for mkEval
that will result in an eval
that nothing at
| all - all incoming actions and queries will be ignored, and no receiver,
| initializer, or finalizer will be specified.
|
| Usually this will be used with record update syntax to override fields to
| specify things as needed. If a component only needs to handle actions,
| for instance, a usage might be something like this:
|
| ```purescript
| H.mkComponent
| { initialState
| , render
| , eval: H.mkEval (H.defaultEval { handleAction = ?handleAction })
| }
| ```
hoist :: forall (query :: Type -> Type) input output (m :: Type -> Type) (m' :: Type -> Type). Functor m' => (m ~> m') -> Component query input output m -> Component query input output m' Source #
Changes the Component's m
type. A use case for this
| might be to interpret some Free
monad as IO
so the component can be
| used with runUI
.
mkComponent :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). ComponentSpec state query action slots input output m -> Component query input output m Source #
mkEval :: forall state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type). EvalSpec state query action slots input output m -> HalogenQ query action input ~> HalogenM state action slots output m Source #
Accepts an EvalSpec
to produce an eval
function for a component. For
| example:
|
| ```purescript
| -- use defaultEval
and override fields selectively
| H.mkEval (H.defaultEval { handleAction = ?handleAction })
|
| -- or specify all the fields in the EvalSpec
| H.mkEval
| { handleAction: ?handleAction
| , handleQuery: ?handleQuery
| , receive: ?receive
| , initialize: ?initialize
| , finalize: ?finalize
| }
| ```
data Component (query :: Type -> Type) input output (m :: Type -> Type) Source #
Constructors
Component (ComponentSpec model query msg slots input output m) |
data ComponentSlot (slots :: Row Type) (m :: Type -> Type) msg Source #
Instances
Functor (ComponentSlot slots' m) Source # | |
Defined in Halogen.Component Methods fmap :: (a -> b) -> ComponentSlot slots' m a -> ComponentSlot slots' m b # (<$) :: a -> ComponentSlot slots' m b -> ComponentSlot slots' m a # |
data ComponentSlotBox (slots :: Row Type) (m :: Type -> Type) msg Source #
Instances
Functor (ComponentSlotBox slots' m) Source # | |
Defined in Halogen.Component Methods fmap :: (a -> b) -> ComponentSlotBox slots' m a -> ComponentSlotBox slots' m b # (<$) :: a -> ComponentSlotBox slots' m b -> ComponentSlotBox slots' m a # |
data ComponentSpec' state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type) (n :: Type -> Type) Source #
Constructors
ComponentSpec | |
Fields
|
data EvalSpec state (query :: Type -> Type) action (slots :: Row Type) input output (m :: Type -> Type) Source #
The spec record that mkEval
accepts to construct a component eval
| function.
|
| It's not a requirement to use mkEval
, and sometimes it's preferrable
| to write a component eval
function from scratch, but often mkEval
is
| more convenient for common cases.
|
| See below for more details about mkEval
and defaultEval
.
Constructors
EvalSpec | |
Fields
|
type ComponentHTML action (slots :: Row Type) (m :: Type -> Type) = HTML (ComponentSlot slots m action) action Source #
A convenience synonym for the output type of a render
function for a
| component that renders HTML.
|
| - action
is the type of actions, events internal to the component that can
| be evaluated with the handleAction
function
| - slots
is the set of child component types that can be used in the HTML
| - m
is the monad used by the child component during evaluation
Instances
IsString Namespace Source # | |
Defined in Halogen.VDom.Types Methods fromString :: String -> Namespace # | |
Show Namespace Source # | |
Eq Namespace Source # | |
Ord Namespace Source # | |
Instances
IsString ClassName Source # | |
Defined in Web.HTML.Common Methods fromString :: String -> ClassName # | |
Show ClassName Source # | |
Eq ClassName Source # | |
Ord ClassName Source # | |
newtype PropName (value :: k) Source #
Instances
IsString (PropName value) Source # | |
Defined in Web.HTML.Common Methods fromString :: String -> PropName value # | |
Show (PropName value) Source # | |
Eq (PropName value) Source # | |
Ord (PropName value) Source # | |
Defined in Web.HTML.Common Methods compare :: PropName value -> PropName value -> Ordering # (<) :: PropName value -> PropName value -> Bool # (<=) :: PropName value -> PropName value -> Bool # (>) :: PropName value -> PropName value -> Bool # (>=) :: PropName value -> PropName value -> Bool # |
module Halogen.Query