ccapndave / elm-typed-tree / TreePath.Tree2

This module provides types and functions for managing a strongly typed tree of depth 2. Each level of the tree can have its own type, and each level can contain Data either of that type, or the leaf type.

Definition


type alias Tree a leaf =
Tree2 a leaf


type TreePath1 a leaf


type TreePath2 a leaf

Encoders and decoders


type alias DecoderConfig a leaf path =
{ level2 : { decoder : Json.Decode.Decoder a
, encoders : a -> List ( String
, Json.Encode.Value )
, pathType : TreePath2 a leaf -> path
, childrenField : String }
, leaf : { decoder : Json.Decode.Decoder leaf
, encode : leaf -> Json.Encode.Value
, pathType : TreePath1 a leaf -> path } 
}

decoder : DecoderConfig a leaf path -> Json.Decode.Decoder (Tree2 a leaf)

pathDecoder : DecoderConfig a leaf path -> Json.Decode.Decoder path

pathEncode1 : DecoderConfig a leaf path -> TreePath1 a leaf -> Json.Encode.Value

pathEncode2 : DecoderConfig a leaf path -> TreePath2 a leaf -> Json.Encode.Value

Path constructor

toRootPath : Tree2 a leaf -> TreePath2 a leaf

Data

data1 : TreePath1 a leaf -> leaf

data2 : TreePath2 a leaf -> TreePath.Data.Data a leaf

Navigation

top1 : TreePath1 a leaf -> TreePath2 a leaf

up1 : TreePath1 a leaf -> Maybe (TreePath2 a leaf)

offset1 : Basics.Int -> TreePath1 a leaf -> Maybe (TreePath1 a leaf)

down1 : Basics.Int -> TreePath1 a leaf -> Maybe Basics.Never

downs1 : TreePath1 a leaf -> List Basics.Never

top2 : TreePath2 a leaf -> TreePath2 a leaf

up2 : TreePath2 a leaf -> Maybe Basics.Never

offset2 : Basics.Int -> TreePath2 a leaf -> Maybe (TreePath2 a leaf)

down2 : Basics.Int -> TreePath2 a leaf -> Maybe (TreePath1 a leaf)

downs2 : TreePath2 a leaf -> List (TreePath1 a leaf)