Giter Club home page Giter Club logo

tea-combine's Introduction

TEA Combine

A set of combinators for working with stateful (and effectful) components.

Using this library you can do this:

import Browser
import CheckBox
import Counter
import Html
import TeaCombine exposing (..)
import TeaCombine.Pure.Pair exposing (..)


main =
    Browser.sandbox
        { init =
            Counter.init 0
                |> initWith (CheckBox.init False)
                |> initWith (CheckBox.init False)
        , view =
            Html.div []
                << (joinViews Counter.view CheckBox.view
                        |> withView CheckBox.view
                   )
        , update =
            Counter.update
                |> updateWith CheckBox.update
                |> updateWith CheckBox.update
        }

and have an app that looks like this (image is clickable!):

screenshot

Here you can find a good explanatory article (thanks to Maldus512!) about how all this stuff works!

More examples

(All the sources you can find here)

  • simple one with Pure combinators,
  • another pure but recursive,
  • one with Effectful combinators,
  • another effectful but recursive,
  • one with form & binding,
  • one with multi-page layout,
  • another multi-page one but with the state resetting on tab switch.

tea-combine's People

Contributors

astynax avatar elm-review-bot avatar heimdell avatar q0w avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tea-combine's Issues

Tree-like model example

It will be good to add a new example that mimics this one but uses the combinators.

Model of tree node should be a TeaCombine.*.Pair of node's data and TeaCombine.*.Many child nodes. We need at least a Pure example but if you will make an Effectful one too it will be great!

Question to recursive components?

Hi, seen your presentation about elm, cool utility. Just one question.
I'm new to elm. You have an example for a list of elements. Is it also possible with your lib (or current elm at all) to compose recursive elements?
I am looking for a general solution for a TreeView CheckBox or Accordion Counter alike structure with nested view elements, each with own view, update, msg etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.