(.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))
