(.using
  [library
   [lux "*"
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: (/.Capability brand input output)
  (format "Represents the capability to perform an operation."
          \n "This operation is assumed to have security implications."))

(documentation: /.use
  "Applies a capability against its required input."
  [(use capability input)])

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

(documentation: /.async
  "Converts a synchronous I/O-based capability into an asynchronous capability."
  [(async capability)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Capability
             ..use
             ..capability:
             ..async]
            []))
