aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/abstract/comonad.lux
blob: 0c81013ff21815a7215f79f732d957c2762b6ead (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
(.using
 [library
  [lux
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" format (.only format)]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" / "_"
  ["[1][0]" cofree]])

(documentation: (/.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."))

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

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..CoMonad
             ..be]
            [/cofree.documentation]))