Turbine
- Package
- purescript-turbine
- Repository
- funkia/purescript-turbine
#Component Source
data Component :: Type -> Type -> Type
Instances
(Semigroup a) => Semigroup (Component o a)
(Monoid a, RowToList row Nil) => Monoid (Component (Record row) a)
Functor (Component o)
Apply (Component o)
(RowToList row Nil) => Applicative (Component (Record row))
Bind (Component o)
(RowToList row Nil) => Monad (Component (Record row))
(RowToList row Nil) => MonadEffect (Component (Record row))
#dynamic Source
dynamic :: forall a o. Behavior (Component o a) -> Component (Record ()) (Behavior o)
Turns a behavior of a component into a component of a behavior. This function is used to create dynamic HTML where the structure of the HTML should change over time.
dynamic (map (\b -> if b else (div {} ) then) behavior)
#MapRecord Source
#static Source
static :: forall row c a. RowToList row c => MapRecord c row Behavior () a => Record row -> Record a
A helper function used to convert static values in records into constant behaviors.
Component functions often takes a large amount of behaviors as input. But, sometimes all that is required is static values, that is, constant behaviors. In these cases it can sometimes be tedious to write records like the following:
{ foo: pure 1, bar: pure 2, baz: pure 3, more: pure 4, fields: pure 5 }
The static
function applies pure
to each value in the given record. As
such, the above can be shortened into the following.
static { foo: 1, bar: 2, baz: 3, more: 4, fields: 5 }
#withStatic Source
withStatic :: forall xs p' q' q p o. RowToList p xs => MapRecord xs p Behavior () p' => Union o p' q' => Nub q' q => Record o -> Record p -> Record q
A function closely related to static
. Usefull in cases where a component
function is to be supplied with both a set of static values (constant
behaviors). The function applies static
to its seconds argument and
merges the two records.
It is often used in infix form as in the following example.
{ foo: behA, bar: behB } `withStatic` { baz: 3, more: 4, fields: 5 }
- Modules
- Turbine
- Turbine.
HTML. Elements
Runs an
Effect
inside aComponent
. The side-effect will be executed when theComponent
is being run.