... 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
    [text (.only \n)
     ["%" \\injection]]]]]
 [\\library
  ["[0]" /]])

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

        ($.definition (/.Capability brand input output)
          (%.message "Represents the capability to perform an operation."
                     \n "This operation is assumed to have security implications."))

        ($.definition /.use
          "Applies a capability against its required input."
          ($.example (' (use capability input))))

        ($.definition /.capability
          "Defines a capability as a unique type, and a constructor for instances."
          ($.example (' (capability (Can_Duplicate a)
                          (can_duplicate a [a a]))))
          ($.example (' (let [capability (can_duplicate
                                          (function (_ value)
                                            [value value]))
                              [left right] (..use capability 123)]
                          (same? left right)))))

        ($.definition /.async
          "Converts a synchronous I/O-based capability into an asynchronous capability."
          ($.example (' (async capability))))
        ))
