functional_zipper library


NodePath<ZS, T>
Node path
Poor man's algebraic data type type path = Top | Node of tree list * path * tree list
Top path
ZipperLocation<ZR, ZI extends ZR, ZS extends ZR>
The main driver of our implementation We require 3 type parameters to handle the lack of algebraic data types in Dart To use this Zipper you need to define three classes ZR: an abstract root class that both ZI and ZS extend ZI: the item class, leaf nodes of the zipper ZS: the section class, branch classes containing children nodes


GetChildren<ZR, ZS> = List<ZR> Function(ZS section)
Given a Section node, return a list of children
MakeSection<ZR, ZS> = ZS Function(ZS node, List<ZR> children)
Given a list of children, create a Section contianing them
SectionP = bool Function(dynamic b)
A more or less direct implementation of Huet's paper Some inspiration from Clojure's zippers in an attemp to make it generic The Dart type system definitely leaves room for desire A predicate to determine if the current node is an Item or a Section