ccapndave/elm-typed-tree/1.0.0

TreePath.Tree3

This module provides types and functions for managing a strongly typed tree of depth 3. 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 b leaf =
Tree3 a b leaf
type TreePath1 a b leaf
type TreePath2 a b leaf
type TreePath3 a b leaf

Encoders and decoders

type alias DecoderConfig a b leaf path =
{ level3 :
{ decoder : Decoder a
, encoders : a -> List ( String, Value )
, pathType : TreePath3 a b leaf -> path
, childrenField : String
}
, level2 :
{ decoder : Decoder b
, encoders : b -> List ( String, Value )
, pathType : TreePath2 a b leaf -> path
, childrenField : String
}
, leaf :
{ decoder : Decoder leaf
, encode : leaf -> Value
, pathType : TreePath1 a b leaf -> path
}
}
decoder : DecoderConfig a b leaf path -> Decoder (Tree3 a b leaf)
pathDecoder : DecoderConfig a b leaf path -> Decoder path
pathEncode1 : DecoderConfig a b leaf path -> TreePath1 a b leaf -> Value
pathEncode2 : DecoderConfig a b leaf path -> TreePath2 a b leaf -> Value
pathEncode3 : DecoderConfig a b leaf path -> TreePath3 a b leaf -> Value

Path constructor

toRootPath : Tree3 a b leaf -> TreePath3 a b leaf

Data

data1 : TreePath1 a b leaf -> leaf
data2 : TreePath2 a b leaf -> Data b leaf
data3 : TreePath3 a b leaf -> Data a leaf

Navigation

top1 : TreePath1 a b leaf -> TreePath3 a b leaf
up1 : TreePath1 a b leaf -> Maybe (TreePath2 a b leaf)
offset1 : Int -> TreePath1 a b leaf -> Maybe (TreePath1 a b leaf)
down1 : Int -> TreePath1 a b leaf -> Maybe Never
downs1 : TreePath1 a b leaf -> List Never
top2 : TreePath2 a b leaf -> TreePath3 a b leaf
up2 : TreePath2 a b leaf -> Maybe (TreePath3 a b leaf)
offset2 : Int -> TreePath2 a b leaf -> Maybe (TreePath2 a b leaf)
down2 : Int -> TreePath2 a b leaf -> Maybe (TreePath1 a b leaf)
downs2 : TreePath2 a b leaf -> List (TreePath1 a b leaf)
top3 : TreePath3 a b leaf -> TreePath3 a b leaf
up3 : TreePath3 a b leaf -> Maybe Never
offset3 : Int -> TreePath3 a b leaf -> Maybe (TreePath3 a b leaf)
down3 : Int -> TreePath3 a b leaf -> Maybe (TreePath2 a b leaf)
downs3 : TreePath3 a b leaf -> List (TreePath2 a b leaf)