Full source code ⋅ Previous chapter ⋅ Next chapter
Sometimes objective could be high-level and we want to split it into manageable activities. For this purpose we need a structure that provides this hierarchial order - Tree.
Initialising a tree without literals is not a pleasant experience (check out the source if you are interested). But let's say we did it already! As an example, we would consider some objective with subtasks. Anyway, we can traverse it printing out its items:
The problem is that if we try to just print them one by one we lose information about hierarchy:
Luckily (what a coincidence again!) we can use additional co-Kleisli morphism with Depth level so that we can indent each item properly:
So now we can see hierarchy between tasks: