(.using
  [library
   [lux {"-" int char type :as}
    ["$" documentation {"+" documentation:}]
    [data
     ["[0]" text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: /.null
  "The null pointer.")

(documentation: /.import:
  "Easily import types, methods, functions and constants."
  [(import: Uint8Array)

   (import: TextEncoder
     ["[1]::[0]"
      (new [/.String])
      (encode [/.String] Uint8Array)])

   (import: TextDecoder
     ["[1]::[0]"
      (new [/.String])
      (decode [/.String] String)])])

(documentation: /.type_of
  "The type of an object, as text."
  [(= "boolean"
      (type_of #1))]
  [(= "number"
      (type_of +123.456))]
  [(= "string"
      (type_of "789"))]
  [(= "function"
      (type_of (function (_ value) value)))])

(documentation: /.constant
  "Allows using definitions from the JavaScript host platform."
  [(constant .Frac [Math PI])])

(documentation: /.closure
  (format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
          \n "This is useful for adapting Lux functions for usage by JavaScript code.")
  [(: /.Function
      (closure [left right]
               (do_something (:as Foo left) (:as Bar right))))])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..null
             ..import:
             ..type_of
             ..constant
             ..closure
             ($.default (/.Object brand))
             ($.default /.Function)
             ($.default /.Symbol)
             ($.default /.Null)
             ($.default /.Undefined)
             ($.default /.Boolean)
             ($.default /.Number)
             ($.default /.String)
             ($.default /.null?)
             ($.default /.on_browser?)
             ($.default /.on_nashorn?)
             ($.default /.on_node_js?)]
            []))
