(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list]]]]]
 ["[0]" \\parser]
 [\\library
  ["[0]" /]])

(def \\parser
  (List $.Documentation)
  (list ($.module \\parser._
                  "")

        ($.definition \\parser.unknown_property)
        
        ($.definition \\parser.Property
          "A property in the environment.")

        ($.definition \\parser.Environment
          "An abstraction for environment variables of a program.")

        ($.definition (\\parser.Parser it)
          "A parser of environment variables of a program.")

        ($.definition \\parser.empty
          "An empty environment.")

        ($.definition \\parser.property
          ""
          [(property name)])

        ($.definition \\parser.result
          (format "Executes a parser against the given environment variables."
                  \n "Does not check whether all environment variables were parsed, since they're usually an open set.")
          [(result parser environment)])
        ))

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

                ($.definition /.unknown_environment_variable)
                ($.definition /.async)
                ($.definition /.default)

                ($.definition (/.Environment !)
                  "Access to ambient environment data and the capacity to exit the program.")

                ($.definition /.environment
                  "Assembles the environment variables available to the program."
                  [(environment monad program)])

                ($.definition /.mock
                  ""
                  [(mock environment home directory)])

                ..\\parser
                ))
