Module

Yoga.Tree.Extended

Package
purescript-yoga-tree-utils
Repository
shamansir/purescript-yoga-tree-utils

#Tree Source

type Tree n = Tree n

#leaf Source

leaf :: forall n. n -> Tree n

Create tree from given single value. |

#node Source

node :: forall n. n -> Array (Tree n) -> Tree n

Create tree from given value and its children. |

#value Source

value :: forall n. Tree n -> n

Get value of this tree node. |

#children Source

children :: forall n. Tree n -> Array (Tree n)

Get children of the this tree node. |

#(:<~) Source

Operator alias for Yoga.Tree.Extended.lnodeOp (right-associative / precedence 5)

#lnodeOp Source

lnodeOp :: forall n. n -> Array n -> Tree n

Node that only has leaves |

#flatten Source

flatten :: forall a. Tree a -> Array a

Convert tree to a flat array structure:

#break Source

break :: forall n a. (n -> Array (Tree n) -> a) -> Tree n -> a

Call this function on both the value and chidlren of this tree node. |

#set Source

set :: forall n. n -> Tree n -> Tree n

Set value of the tree node. |

#update Source

update :: forall n. (n -> n) -> Tree n -> Tree n

Update value of the tree node using its current value. |

#catMaybes Source

catMaybes :: forall n. n -> Tree (Maybe n) -> Tree n

Leave only Just values in the tree. |

#edges Source

edges :: forall n. Tree n -> Array (n /\ n)

#EdgeState Source

type EdgeState n = { edges :: Array (n /\ n), trees :: Array (Tree n) }

#edgesAux Source

edgesAux :: forall n. EdgeState n -> EdgeState n