(.using
  [library
   [lux
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" 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]))
