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

(`` (def .public documentation
      (List $.Documentation)
      (let [literal (list (,, (with_template [<name> <type>]
                                [($.definition <name>
                                   (%.code (' (<name>
                                               (is <type>
                                                   (value generating expression))))))]

                                [/.nat .Nat]
                                [/.int .Int]
                                [/.rev .Rev]
                                [/.frac .Frac]
                                [/.text .Text]
                                ))

                          ($.definition /.literal
                            ""
                            [(/.literal
                              (is (-> ??? Code)
                                  format)
                              (is ???
                                  (value generating expression)))]))
            random (list (,, (with_template [<name> <type>]
                               [($.definition <name>
                                  (%.code (' (is <type>
                                                 (<name>)))))]

                               [/.random_nat .Nat]
                               [/.random_int .Int]
                               [/.random_rev .Rev]
                               [/.random_frac .Frac]
                               ))

                         ($.definition /.random
                           ""
                           [(/.random
                             (is (-> ??? Code)
                                 format)
                             (is (Random ???)
                                 (random data generator)))]))]
        (list.partial ($.module /._
                                "")

                      (list.together
                       (list literal
                             random))
                      ))))
