aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/security/capability.lux
blob: 2eab5e48fdba0797d50af211acd050d6beb289b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(.using
 [library
  [lux (.except)
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" format (.only 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]
            []))