Coder Social home page Coder Social logo

elm-multiway-tree-zipper's Introduction

MultiwayTreeZipper

This library was created with the goal of allowing a multiway tree to be navigated and updated.

I ran into the problem when designing a tree UI control to use with The Elm Architecture. I realized that to keep track of the state in the model for things like whether a node is selected or expanded, I needed a way to update specific nodes through actions.

There will be more examples to come, but this is meant as a library to solve a piece of the puzzle, which will be used with others to create a Tree UI control

Run tests (from a cloned repo)

npm install -g elm
cd tests
elm-package install -y
elm-make Tests.elm --output tests.js
node tests.js

NOTE: elm-test Tests.elm -c elm-make.cmd might have to be used if running on Windows.

Looking for Elm 0.19?

I upgraded to the latest version of elm in a separate branch due to changes to both how dependencies are managed and tests are performed. That code lives in the elm-0.19-upgrade branch, and has been deployed to Elm Packages as version 1.10.3.

The API did not change, however, the custom operator that was demonstrated in docs and the tests, (&>) can no longer be used as of 0.19. I updated both to use the best concise alternative I could, which uses|> Maybe.andThen and partial application. See the test for an example!

elm-multiway-tree-zipper's People

Contributors

inactivist avatar patrickdet avatar tomjkidd 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

Watchers

 avatar  avatar  avatar  avatar

elm-multiway-tree-zipper's Issues

Multiple cursors support

Hi! Don't you plan to add support for a zipper with multiple cursors, like described here?

I'm currently trying this package out to manage nodes selections in a tree, and I aim to provide multiple selections over time.

If you don't plan to implement this, probably you could direct me to some article or book where I can find more practical instructions on implementing such a thing. Where did you get the basis during your work on this library?

indexedMap doesn't need to return a Maybe

Since mapListOverTree only returns Nothing if its list is empty, indexedMap builds a list based on the length of the tree, and a multiway tree always has at least one node I don't think there is any way for indexedMap to actually return Nothing.

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.