miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Binding

Description

 
Synopsis

Types

data Binding parent child Source #

Type used for React-like "props" functionality. This is used to to bind parent model changes to the child model, or vice versa.

The difference between miso and React here is that miso is synchronizing model states of Components declaratively (outside of the view). In React "props" are used in the view code.

https://react.dev/learn/passing-props-to-a-component

This can be thought of as establishing an "edge" in the Component graph, whereby events cause model change synchronization to "ripple" or "pulsate" through the views. The "reactivity" of the graph is constructed manually by the end-user, using the edge primitives -->, <--, <--> (reactive combinators).

This can also be thought of as a Wire (from netwire) for reactive variable synchronization, except done at the granularity specified by the Lens.

main :: IO ()
main = run app { bindings = [ parentLens -- childLens ] }

Since: 1.9.0.0

Constructors

ParentToChild (Getter parent field) (Setter child field) 
ChildToParent (Setter parent field) (Getter child field) 
Bidirectional (Getter parent field) (Setter parent field) (Getter child field) (Setter child field) 

Combinators

(<-->) :: Lens parent field -> Lens child field -> Binding parent child Source #

Bidirectionally binds a child field to a parent field, using Lens

This is a bidirectional reactive combinator for a miso Lens.

Since: 1.9.0.0

(<--) :: Lens parent a -> Lens model a -> Binding parent model Source #

Unidirectionally binds a child field to a parent field

Since: 1.9.0.0

(-->) :: Lens parent a -> Lens model a -> Binding parent model Source #

Unidirectionally binds a parent field to a child field

Since: 1.9.0.0

(<--->) :: Lens' parent field -> Lens' child field -> Binding parent child Source #

Bidirectionally binds a child field to a parent field, using Lens'

This is a bidirectional reactive combinator for a van Laarhoven Lens'

Since: 1.9.0.0

(<---) :: Lens' parent field -> Lens' child field -> Binding parent child Source #

Unidirectionally binds a child field to a parent field, for van Laarhoven style Lens'

Since: 1.9.0.0

(--->) :: Lens' parent field -> Lens' child field -> Binding parent child Source #

Unidirectionally binds a parent field to a child field, for van Laarhoven style Lens'

Since: 1.9.0.0