astynax/tea-combine/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

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).

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

An infix version for the @viewBoth.

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 model1 msg1
-> View model2 msg2
-> Both model1 model2
-> List (Html (Either msg1 msg2))

An infix alias for @joinViews.

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

Continues a "joinViews+[withView]" chain by adding an another sub-view.

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

An infix alias for @withView.

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 a "bind+[thenBind]"-chain.

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

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