(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]])

(.def .public documentation
  (.List $.Documentation)
  (list ($.module /._
                  "")

        ($.definition /.clean_up_error)
        ($.definition /.functor)
        ($.definition /.apply)
        ($.definition /.monad)

        ($.definition (/.Region r ! it)
          (format "A region where resources may be be claimed and where a side-effecting computation may be performed."
                  \n "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks."))

        ($.definition /.run!
          "Executes a region-based computation, with a side-effect determined by the monad."
          [(run! monad computation)])

        ($.definition /.acquire!
          "Acquire a resource while pairing it a function that knows how to reclaim it."
          [(acquire! monad cleaner value)])

        ($.definition /.failure
          "Immediately fail with this 'message'."
          [(failure monad error)])

        ($.definition /.except
          "Fail by throwing/raising an exception."
          [(except monad exception message)])

        ($.definition /.lifted
          "Lift an effectful computation into a region-based computation."
          [(lifted monad operation)])
        ))
