aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/io.lux
blob: 9e427c35d18ed93eb4812b6a72a8b604d95a2c4d (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
(.module:
  [library
   [lux {"-" [if loop]}
    ["$" documentation {"+" [documentation:]}]
    [data
     [text {"+" [\n]}
      ["%" format {"+" [format]}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: (/.IO it)
  "A type that represents synchronous, effectful computations that may interact with the outside world.")

(documentation: /.io
  (format "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'."
          \n "Great for wrapping effectful computations (which will not be performed until the IO is 'run!').")
  [(io (exec
         (log! msg)
         "Some value..."))])

(documentation: /.run!
  "A way to execute IO computations and perform their side-effects.")

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code."
            [..IO
             ..io
             ..run!
             ($.default /.functor)
             ($.default /.apply)
             ($.default /.monad)]
            []))