Tea API and Documentation

website·Indexed 30 days ago

https://mel-tea.gitlab.io

Documentation for Tea, including the Tea API for web development (Vdom, Tea_http, Tea_svg, Tea_program), the Tablecloth utility library (TableclothList, TableclothMap, TableclothInt), and guides on The Elm Architecture and BuckleScript interop.

Tokens
61.5K
Snippets
554
Records
617
Agent score
74%

What's inside Tea

  1. Overview of BuckleScript

    BuckleScript is an optimizing compiler designed for large-scale programming on the JavaScript platform. It reuses the OCaml programming language to deliver type safety and expressiveness while generating performant, debuggable, and readable JavaScript code. Unlike many other transpilers, it aims for extremely fast compilation times and produces smaller output code than hand-written JavaScript by aggressively eliminating dead code.
  2. Overview of TableclothArray

    The TableclothArray module provides a mutable vector of elements of the same type. It offers constant time O(1) operations for accessing elements (get), modifying elements (set), and retrieving the length. Arrays have a fixed length; for dynamic sizing, a List is recommended.
    type 'a t = 'a array
  3. Overview of TableclothMap

    A Map is an immutable data structure representing a unique mapping from keys to values. Because it is immutable, operations such as add and remove return a new map rather than modifying the existing one. For common key types, specialized Map.Int and Map.String modules are available. Custom data types can be used as keys if they satisfy the TableclothComparator.S interface.
  4. Overview of TableclothChar module

    The TableclothChar module provides functions for working with single characters. It operates exclusively on ASCII characters (range 0-255) and does not support Unicode. Users are advised to stick to the 0-127 range to avoid inconsistencies between ISO 8859-1 and Windows 1252 standards. Character literals are defined using single quotes (e.g., 'a').
    let digit = '7'
  5. Overview of TableclothSet

    A Set is an immutable collection of unique values. Because it is immutable, operations like add and remove return a new set rather than modifying the existing one. For common types, specialized Set.Int and Set.String modules are available. Custom data types can be used if they satisfy the TableclothComparator.S interface.
  6. Overview of TableclothList

    TableclothList provides an immutable singly-linked list of elements of the same type. It is optimized for O(1) operations at the front of the list (head, tail, and cons). However, accessing elements by index (getAt) or calculating the length are O(n) operations. For use-cases requiring frequent random access or length checks, an Array is recommended. The list type supports exhaustive pattern matching.
    match aList with
    | [] -> "Empty"
    | [a] -> "Exactly one element"
    | [a, b] -> "Exactly two elements"
    | a :: b :: cs -> "More than two elements"
  7. Overview of BuckleScript

    BuckleScript is a compiler that takes OCaml (a fast, pragmatic, and typed language) and compiles it into clean, readable, and performant JavaScript. It allows developers to use an industrial-strength language while remaining compatible with standard JavaScript tools such as npm, yarn, bundlers, minifiers, and devtools. It also provides built-in support for Reason to offer a more familiar experience for JavaScript developers.
  8. Manage browser session history with Web_window_history

    The Web_window_history module provides a set of functions and a type t to interact with the browser's history object. It allows for navigating the history stack, retrieving the current history length, and managing the state object and URL associated with the current history entry.
  9. Target native platforms with OCaml

    Because BuckleScript is based on OCaml, code can be targeted to native machine code instead of JavaScript for high-performance requirements. This allows the same logic to run on servers, desktops, mobile OSes, and even microcontrollers with limited memory. Native compilation significantly reduces startup time (e.g., ~2ms compared to >100ms for a typical Node.js application).
  10. Understand shared data types for JS interop

    BuckleScript primitives known as 'shared data types' compile to the exact same representation in JavaScript. This allows them to be passed between BuckleScript and JavaScript without conversion. These types are guaranteed public representations.