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

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

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

        ($.definition (/.Try it)
          "A computation that can fail with an error message.")

        ($.definition /.with
          "Enhances a monad with error-handling functionality."
          [(with monad)])

        ($.definition /.lifted
          "Wraps a monadic value with error-handling machinery."
          [(lifted monad)])

        ($.definition /.trusted
          (format "Assumes a Try value succeeded, and yields its value."
                  \n "If it didn't, raises the error as a runtime error."
                  \n "WARNING: Use with caution.")
          [(trusted try)])

        ($.definition /.maybe
          ""
          [(maybe try)])

        ($.definition /.of_maybe
          ""
          [(of_maybe maybe)])

        ($.definition /.else
          (format "Allows you to provide a default value that will be used"
                  \n "if a (Try x) value turns out to be #Failure."
                  \n "Note: the expression for the default value will not be computed if the base computation succeeds.")
          [(= "bar"
              (else "foo" {/.#Success "bar"}))]
          [(= "foo"
              (else "foo" {/.#Failure "KABOOM!"}))])
        ))
