This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Strict multiway trees aka rosetrees and a Zipper to go with them
version 1.2.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.2.0
Committed At 2018-08-07 17:39:24 UTC
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1



Multiway trees and a zipper Build Status

This library provides a multiway tree (also known as rosetree) datastructure, and a zipper to navigate through it.

A multiway tree is a non-empty tree where every node has a label and a list of children, each of which is a tree.

The basic structure looks like this:

type Tree a = Tree { label : a, children : List (Tree a) }

You can think of it as a multidimensional non-empty list. The root always has a label and may branch out in multiple directions.

A tree zipper is a datastructure that allows navigating through a tree. It represents a waypoint along walking the tree. It can focus on an arbitratry part of the tree, be used to modify and transform that part of the tree, and rebuild the entire tree back up to the root.

Performance and stack-safety

Since trees can grow pretty large, a lot of effort has gone into making all the functions in the Tree module work stack-safely. All the iteration functions in that module are written to make use of Elm's support for tail call elimination.

Making these functions highly performant without losing out on the safety is a continuous effort.


Contributions are preferred to take the form of collaboration. Questions, bug reports and feature requests are welcome as GitHub issues. Before starting any concrete work, opening a discussion is very much appreciated.

Made with love and released under the BSD-3 license.