(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list]]]
   [meta
    ["@" target]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" watch]])

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

                        ($.definition /.async)
                        ($.definition /.cannot_make_file)
                        ($.definition /.cannot_find_file)
                        ($.definition /.cannot_delete)
                        ($.definition /.cannot_make_directory)
                        ($.definition /.cannot_find_directory)
                        (,, (for @.lua (,, (these))
                                 (,, (these ($.definition /.default)))))

                        ($.definition /.Path
                          "A path to a file or a directory in a file-system.")

                        ($.definition (/.System !)
                          "An interface to a file-system.")

                        ($.definition /.parent
                          "If a path represents a nested file/directory, extracts its parent directory."
                          [(parent fs path)])

                        ($.definition /.name
                          "The un-nested name of a file/directory."
                          [(name fs path)])

                        ($.definition /.rooted
                          "A nested path for a file/directory, given a root/parent path and a file/directory name within it."
                          [(rooted fs parent child)])

                        ($.definition /.exists?
                          "Checks if either a file or a directory exists at the given path."
                          [(exists? monad fs path)])

                        ($.definition /.mock
                          (format "A purely in-memory simulation of a file-system."
                                  \n "Useful for testing.")
                          [(mock separator)])

                        ($.definition /.make_directories
                          (format "Creates the directory specified by the given path."
                                  \n "Also, creates every super-directory necessary to make the given path valid.")
                          [(make_directories monad fs path)])

                        ($.definition /.make_file
                          "Creates a new file with the given content if-and-only-if the file does not already exist."
                          [(make_file monad fs content path)])

                        /watch.documentation
                        ))))
