... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [collection
     ["[0]" list (.use "[1]#[0]" monoid)]]]
   [meta
    [macro
     ["[0]" template]]]]]
 ["[0]" \\projection]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" finger]
  ["[1][0]" zipper]])

(`` (the \\projection
      (List $.Documentation)
      (list ($.module \\projection._
                      "")

            ($.definition \\projection.cannot_move_further)

            ($.definition (\\projection.Projection it)
              "A projection of arbitrary trees.")

            ($.definition \\projection.value'
              "Applies the projection against a tree zipper."
              ($.example (' (value' projection zipper))))

            ($.definition \\projection.value
              "Applies the projection against a tree."
              ($.example (' (value projection tree))))

            ($.definition \\projection.value
              "Yields the value inside the current tree node.")

            (,, (template.with [<name> <doc>]
                  [($.definition <name>
                     <doc>)]

                  [\\projection.down "Move down."]
                  [\\projection.up "Move up."]

                  [\\projection.right "Move to the right."]
                  [\\projection.rightmost "Move to the rightmost node."]

                  [\\projection.left "Move to the left."]
                  [\\projection.leftmost "Move to the leftmost node."]
                  
                  [\\projection.next "Move to the next node."]
                  [\\projection.end "Move to the last node."]
                  
                  [\\projection.previous "Move to the previous node."]
                  [\\projection.start "Move to the root node."]
                  ))
            )))

(the .public documentation
  (List $.Documentation)
  (list.partial ($.module /._
                          "")

                ($.definition /.equivalence)
                ($.definition /.functor)
                ($.definition /.mix)

                ($.definition (/.Tree it)
                  "A generic tree data-structure.")

                ($.definition /.flat
                  "All the leaf values of the tree, in order."
                  ($.example (' (flat tree))))

                ($.definition /.leaf
                  ""
                  ($.example (' (leaf value))))

                ($.definition /.branch
                  ""
                  ($.example (' (branch value children))))

                ($.definition /.tree
                  "Tree literals."
                  ($.example (' (is (Tree Natural)
                                    (tree 12
                                          {34 {}
                                              56 {}
                                              78 {90 {}}})))))

                (all list#composite
                     ..\\projection
                     /finger.documentation
                     /zipper.documentation
                     )
                ))
