... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

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

(the .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."
          ($.example (' (with monad))))

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

        ($.definition /.trusted
          (%.message "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.")
          ($.example (' (trusted try))))

        ($.definition /.maybe
          ""
          ($.example (' (maybe try))))

        ($.definition /.of_maybe
          ""
          ($.example (' (of_maybe "Error if #None"
                                  maybe))))

        ($.definition /.else
          (%.message "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.")
          ($.example (' (= "bar"
                           (else "foo" {/.#Success "bar"}))))
          ($.example (' (= "foo"
                           (else "foo" {/.#Failure "KABOOM!"})))))
        ))
