astynax/tea-combine/2.0.1

NOTE: the latest version is 3.1.0

TeaCombine

The common types and combinators.

TODO: add some great docs.

type alias View model msg =
model -> Html msg

An alias for the view function.

type alias Both a b =
( a, b )

An alias for the pair of things (product of two types).

type Ix a
= Ix Int a

Wrapper type that adds an index.

initAll : List a -> Array a

Just an alias for Array.fromList (made for convinience).

View model1 msg1
-> View model2 msg2
-> Both model1 model2
-> Both (Html (Either msg1 msg2)) (Html (Either msg1 msg2))

Combines two sub-views into a pair (Both).

viewAll : List (View model msg) -> Array model -> List (Html (Ix msg))

Returns a list of Html produced by applying a List of sub-views to the List of sub-models (like List.zip does).

viewEach : (Int -> View model msg) -> Array model -> List (Html (Ix msg))

Returns a list of Html produced by applying an index-aware view to the each of sub-models.

(Int -> Maybe (View model msg))
-> Array model
-> List (Html (Ix msg))

Works as viewEach but returns only some of sub-views.

View model1 msg1
-> View model2 msg2
-> Both model1 model2
-> List (Html (Either msg1 msg2))

Works as viewBoth but returns a function that produces a List of sub-views.

This is a first step of "joinViews+[withView]" chain.

View model2 msg2
-> (model1 -> List (Html msg1))
-> Both model1 model2
-> List (Html (Either msg1 msg2))

Adds an another step to the "joinViews+[withView]" chain.

bind : (a -> b) -> (model -> a) -> model -> b

Makes a function that applies a getter to the model and then modifies result.

This is a first step in the "bind+[thenBind]"-chain.

thenBind : (model2 -> a) -> (model1 -> a -> b) -> Both model1 model2 -> b

Adds an another step to the "bind+[thenBind]"-chain.

View model1 msg1
-> View model2 msg2
-> Either () ()
-> Both model1 model2
-> Html (Either msg1 msg2)

Combines two views and lets to select (using path) which one should be applied to the combined model.

This is a first step in a "oneOfViews+[orView]"-chain.

View model2 msg2
-> (path -> model1 -> Html msg1)
-> Either path ()
-> Both model1 model2
-> Html (Either msg1 msg2)

Adds an another view to the "oneOfViews+[orView]"-chain.

oneOfPaths : a -> a -> List ( a, Either () () )

Combines two path labels.

This is a first step in the "oneOfViews+[orView]"-chain.

orPath : a -> List ( a, b ) -> List ( a, Either b () )

Adds an another path label to the "oneOfPaths+[orPath]"-chain.