... 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]]
    [collection
     ["[0]" list]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" free]])

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

                ($.definition (/.Monad it)
                  (%.message "A monad is a monoid in the category of endofunctors."
                             \n "What's the problem?"))

                ($.definition /.do
                  "Macro for easy concatenation of monadic operations."
                  ($.example (' (do monad
                                  [y (f1 x)
                                   z (f2 z)]
                                  (in (f3 z))))))

                ($.definition /.then
                  "Apply a function with monadic effects to a monadic value and yield a new monadic value."
                  ($.example (' (then monad function))))

                ($.definition /.all
                  "Run all the monadic values in the list and produce a list of the base values."
                  ($.example (' (all monad))))

                ($.definition /.each
                  "Apply a monadic function to all values in a list."
                  ($.example (' (each monad function items))))

                ($.definition /.only
                  "Filter the values in a list with a monadic function."
                  ($.example (' (only monad predicate items))))

                ($.definition /.mix
                  "Mix a list with a monadic function."
                  ($.example (' (mix monad function initial_value items))))

                /free.documentation
                ))
