ccapndave / elm-typed-tree / TreePath.Tree4

This module provides types and functions for managing a strongly typed tree of depth 4. 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 c leaf =
Tree4 a b c leaf


type TreePath1 a b c leaf


type TreePath2 a b c leaf


type TreePath3 a b c leaf


type TreePath4 a b c leaf

Encoders and decoders


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

decoder : DecoderConfig a b c leaf path -> Json.Decode.Decoder (Tree4 a b c leaf)

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

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

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

pathEncode3 : DecoderConfig a b c leaf path -> TreePath3 a b c leaf -> Json.Encode.Value

pathEncode4 : DecoderConfig a b c leaf path -> TreePath4 a b c leaf -> Json.Encode.Value

Path constructor

toRootPath : Tree4 a b c leaf -> TreePath4 a b c leaf

Data

data1 : TreePath1 a b c leaf -> leaf

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

data3 : TreePath3 a b c leaf -> TreePath.Data.Data b leaf

data4 : TreePath4 a b c leaf -> TreePath.Data.Data a leaf

Navigation

top1 : TreePath1 a b c leaf -> TreePath4 a b c leaf

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

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

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

downs1 : TreePath1 a b c leaf -> List Basics.Never

top2 : TreePath2 a b c leaf -> TreePath4 a b c leaf

up2 : TreePath2 a b c leaf -> Maybe (TreePath3 a b c leaf)

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

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

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

top3 : TreePath3 a b c leaf -> TreePath4 a b c leaf

up3 : TreePath3 a b c leaf -> Maybe (TreePath4 a b c leaf)

offset3 : Basics.Int -> TreePath3 a b c leaf -> Maybe (TreePath3 a b c leaf)

down3 : Basics.Int -> TreePath3 a b c leaf -> Maybe (TreePath2 a b c leaf)

downs3 : TreePath3 a b c leaf -> List (TreePath2 a b c leaf)

top4 : TreePath4 a b c leaf -> TreePath4 a b c leaf

up4 : TreePath4 a b c leaf -> Maybe Basics.Never

offset4 : Basics.Int -> TreePath4 a b c leaf -> Maybe (TreePath4 a b c leaf)

down4 : Basics.Int -> TreePath4 a b c leaf -> Maybe (TreePath3 a b c leaf)

downs4 : TreePath4 a b c leaf -> List (TreePath3 a b c leaf)