aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/abstract/comonad.lux
blob: dd4fbc2e0c376acd0c170a4c9c3139059d01461f (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
(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" free]])

(def .public documentation
  (List $.Documentation)
  (list.partial ($.module /._
                          "")
                ($.definition (/.CoMonad !)
                  (format "Co-monads are the opposite/complement to monads."
                          \n "Co-monadic structures are often infinite in size and built upon lazily-evaluated functions."))

                ($.definition /.be
                  "A co-monadic parallel to the 'do' macro."
                  [(let [square (function (_ n) (* n n))]
                     (be comonad
                       [inputs (iterate ++ +2)]
                       (square (out inputs))))])

                /free.documentation))