(.using
 [library
  [lux "*"
   ["$" documentation {"+" documentation:}]
   ["@" target]
   [control
    ["<>" parser
     ["<[0]>" code]]]
   [data
    ["[0]" text {"+" \n}
     ["%" format {"+" format}]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]]
 ["[0]" / "_"
  ["[1][0]" watch]])

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

(documentation: (/.System !)
  "An interface to a file-system.")

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

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

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

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

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

(documentation: /.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)])

(documentation: /.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)])

(.def: .public documentation
  (.List $.Module)
  (`` (`` ($.module /._
                    ""
                    [..Path
                     ..System
                     ..parent
                     ..name
                     ..rooted
                     ..exists?
                     ..mock
                     ..make_directories
                     ..make_file
                     ($.default /.async)
                     ($.default /.cannot_make_file)
                     ($.default /.cannot_find_file)
                     ($.default /.cannot_delete)
                     ($.default /.cannot_make_directory)
                     ($.default /.cannot_find_directory)
                     ($.default /.cannot_read_all_data)
                     (~~ (for [@.jvm (~~ (as_is ($.default /.cannot_modify_file)
                                                ($.default /.default)))
                               @.js (~~ (as_is ($.default /.default)))
                               @.python (~~ (as_is ($.default /.default)))
                               @.ruby (~~ (as_is ($.default /.default)))]
                              (~~ (as_is))))]
                    [/watch.documentation]))))
