Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ overview-slides.html : overview-slides.md
# # -V maxScale=2

base:
mo-doc --source $(MOTOKO_BASE) --output $(OUT)/base --format plain
mo-doc --source $(MOTOKO_CORE) --package core --output $(OUT)/core --format plain
mo-doc --source $(MOTOKO_BASE) --package base --output $(OUT)/base --format plain

html:
# TODO: perhaps use node and remark-cli to compile out remark plugins first or use docusaurus to build site properly
Expand Down
6 changes: 6 additions & 0 deletions doc/docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ const config = {
position: 'left',
label: 'Base',
},
{
type: 'doc',
docId: 'core/index',
position: 'left',
label: 'Core',
},
{
href: 'https://github.com/dfinity/motoko',
label: 'GitHub',
Expand Down
10 changes: 10 additions & 0 deletions doc/docusaurus/static/load_moc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";

const BASE_VERSION = "0.14.8"; /* This may be slightly behind the base files we have locally in nix/sources.json */
const CORE_VERSION = "0.5.0"; /* This may be slightly behind the base files we have locally in nix/sources.json */

async function addPackage(name, repo, version, dir) {
const meta_url = `https://data.jsdelivr.com/v1/package/gh/${repo}@${version}/flat`;
Expand Down Expand Up @@ -35,6 +36,15 @@ function attachOnRunButton() {
btns[i].click();
}
});
addPackage("core", "dfinity/motoko-core", `preview-${CORE_VERSION}`, "src")
.then(() => {
console.log(`core library version: ${CORE_VERSION}`);
// Run code
const btns = document.getElementsByClassName("run-button run");
for (var i = 0; i < btns.length; i++) {
btns[i].click();
}
});
});
document.head.appendChild(script);
} else {
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Array.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Array
# base/Array
Provides extended utility functions on Arrays.

:::warning
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/AssocList.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AssocList
# base/AssocList
Map implemented as a linked-list of key-value pairs ("Associations").

:::note Usage context
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Blob.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Blob
# base/Blob
`Blob` is an immutable, iterable sequence of bytes. Unlike `[Nat8]`, which is less compact (using 4 bytes per logical byte), `Blob` provides a more efficient representation.

Blobs are not indexable and can be empty. To manipulate a `Blob`, convert it to `[var Nat8]` or `Buffer<Nat8>`, perform your changes, then convert it back.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Bool.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bool
# base/Bool
Boolean type and operations.

While boolean operators `_ and _` and `_ or _` are short-circuiting,
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Buffer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Buffer
# base/Buffer
Class `Buffer<X>` provides a mutable list of elements of type `X`.
It wraps a resizable underlying array and is comparable to `ArrayList` or `Vector` in other languages.

Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/CertifiedData.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CertifiedData
# base/CertifiedData
The Internet Computer allows canister smart contracts to store a small amount of data during
update method processing so that during query call processing, the canister can obtain
a certificate about that data.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Char.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Char
# base/Char

## Type `Char`
``` motoko no-repl
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Debug.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Debug
# base/Debug
Utility functions for debugging.

Import from the base library to use this module.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Deque.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deque
# base/Deque
Double-ended queue (deque) of a generic element type `T`.

The interface of deques is purely functional, not imperative, and deques are immutable values.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Error.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Error
# base/Error
Error values and inspection.

The `Error` type is the argument to `throw`, parameter of `catch`.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/ExperimentalCycles.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ExperimentalCycles
# base/ExperimentalCycles
Managing cycles within actors on the Internet Computer (ICP).

The usage of the Internet Computer is measured, and paid for, in _cycles_.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/ExperimentalInternetComputer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ExperimentalInternetComputer
# base/ExperimentalInternetComputer
Low-level interface to the Internet Computer.

:::warning Experimental API
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/ExperimentalStableMemory.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ExperimentalStableMemory
# base/ExperimentalStableMemory
Byte-level access to (virtual) _stable memory_.

:::warning Experimental module
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Float.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Float
# base/Float
Double precision (64-bit) floating-point numbers in IEEE 754 representation.

This module contains common floating-point constants and utility functions.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Func.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Func
# base/Func
Create functions from simpler inputs, most commonly used when programming in functional style using higher-order functions.

## Function `compose`
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Hash.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hash
# base/Hash

## Type `Hash`
``` motoko no-repl
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/HashMap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HashMap
# base/HashMap
Class `HashMap<K, V>` provides a hashmap from keys of type `K` to values of type `V`.
The class is parameterized by the key's equality and hash functions, and an initial capacity.
However, the underlying allocation occurs only upon the first insertion.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Heap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Heap
# base/Heap
Class `Heap<X>` provides a priority queue of elements of type `X`.

The class wraps a purely-functional implementation based on a leftist heap.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Int.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Int
# base/Int
Signed integer numbers with infinite precision (also called big integers).

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Int16.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Int16
# base/Int16
Provides utility functions on 16-bit signed integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Int32.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Int32
# base/Int32
Provides utility functions on 32-bit signed integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Int64.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Int64
# base/Int64
Provides utility functions on 64-bit signed integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Int8.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Int8
# base/Int8
Provides utility functions on 8-bit signed integers.

:::info Function form for higher-order use
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Iter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Iter
# base/Iter

## Type `Iter`
``` motoko no-repl
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/IterType.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IterType
# base/IterType

## Type `Iter`
``` motoko no-repl
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/List.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# List
# base/List
Purely-functional, singly-linked lists.
A list of type `List<T>` is either `null` or an optional pair of a value of type `T` and a tail, itself of type `List<T>`.

Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Nat.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nat
# base/Nat
Natural numbers with infinite precision.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Nat16.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nat16
# base/Nat16
Provides utility functions on 16-bit unsigned integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Nat32.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nat32
# base/Nat32
Provides utility functions on 32-bit unsigned integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Nat64.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nat64
# base/Nat64
Provides utility functions on 64-bit unsigned integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Nat8.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nat8
# base/Nat8
Provides utility functions on 8-bit unsigned integers.

:::note
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/None.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# None
# base/None
The `None` type represents a type with _no_ value.

It is often used to type code that fails to return control (e.g. an infinite loop)
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Option.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Option
# base/Option
Optional values can be seen as a typesafe `null`. A value of type `?Int` can
be constructed with either `null` or `?42`. The simplest way to get at the
contents of an optional is to use pattern matching:
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Order.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Order
# base/Order

## Type `Order`
``` motoko no-repl
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/OrderedMap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OrderedMap
# base/OrderedMap
Stable key-value map implemented as a red-black tree with nodes storing key-value pairs.

A red-black tree is a balanced binary search tree ordered by the keys.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/OrderedSet.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OrderedSet
# base/OrderedSet
Stable ordered set implemented as a red-black tree.

A red-black tree is a balanced binary search tree ordered by the elements.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Prelude.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Prelude
# base/Prelude
This prelude file proposes standard library features that _may_
belong in the _language_ (compiler-internal) prelude sometime, after
some further experience and discussion. Until then, they live here.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Principal.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Principal
# base/Principal
Module for interacting with Principals (users, canisters, or other entities).

Principals are used to identify entities that can interact with the Internet
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/RBTree.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RBTree
# base/RBTree
Key-value map implemented as a red-black tree (RBTree) with nodes storing key-value pairs.

A red-black tree is a balanced binary search tree ordered by the keys.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Random.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Random
# base/Random
A module for obtaining randomness on the Internet Computer (IC).

This module provides the fundamentals for user abstractions to build on.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Region.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Region
# base/Region
Byte-level access to isolated, (virtual) stable memory _regions_.

This is a moderately lightweight abstraction over IC _stable memory_ and supports persisting
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Result.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Result
# base/Result
Error handling with the `Result` type.

## Type `Result`
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Stack.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stack
# base/Stack
Class `Stack<X>` provides a minimal LIFO stack of elements of type `X`.

See library `Deque` for mixed LIFO/FIFO behavior.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Text.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Text
# base/Text
Utility functions for `Text` values.

A `Text` value represents human-readable text as a sequence of characters of type `Char`.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Time.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Time
# base/Time
System time

## Type `Time`
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Timer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Timer
# base/Timer
Timers for one-off or periodic tasks. Applicable as part of the default mechanism.

:::note Timer resolution
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/Trie.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Trie
# base/Trie
Functional key-value hash map.

Provides an applicative (purely functional) hash map, called a *trie*, where each operation returns a new version of the structure without mutating the original.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/TrieMap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TrieMap
# base/TrieMap
Class `TrieMap<K, V>` provides a map from keys of type `K` to values of type `V`.
The class wraps and manipulates an underlying hash trie, found in the `Trie` module.
The trie is a binary tree where element positions are determined using the hash of the keys.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/TrieSet.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TrieSet
# base/TrieSet

Sets are partial maps from element type to unit type,
i.e., the partial map represents the set with its domain.
Expand Down
2 changes: 1 addition & 1 deletion doc/md/base/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Index
# Index of package base

* [Array](Array.md) Provides extended utility functions on Arrays.
* [AssocList](AssocList.md) Map implemented as a linked-list of key-value pairs ("Associations").
Expand Down
Loading
Loading