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
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Motoko compiler changelog

* motoko-base:

* reformat to style guidelines
* add type bindings `Nat.Nat`, `Nat8.Nat8` etc. to libraries for primitive types.

* Bugfix: generation of candid from Motoko:

* no longer confused by distinct, but eponymous, type definitions (Bug: #2529);
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"homepage": null,
"owner": "dfinity",
"repo": "motoko-base",
"rev": "712e857cb1a0d2149da8027fe746cfb8e346cc58",
"sha256": "0smvjx9i7a6jjbzgliw6n6f6gz3jvqv04ywcrjfvzxfida4h8cjc",
"rev": "1b0b25399fe5747bf63321950f386ed6263456fe",
"sha256": "1r1y61gaqpazm1h35mz0ds4yd8imqm39pdxmpiaj5mg3sgykxdlw",
"type": "tarball",
"url": "https://github.com/dfinity/motoko-base/archive/712e857cb1a0d2149da8027fe746cfb8e346cc58.tar.gz",
"url": "https://github.com/dfinity/motoko-base/archive/1b0b25399fe5747bf63321950f386ed6263456fe.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"motoko-matchers": {
Expand Down
23 changes: 23 additions & 0 deletions src/prelude/prim.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ Nevertheless, it shoud be _safe_ to import prim, i.e. the definitions here
should not break type safety or other guarantees of the language.
*/

module Types = {
public type Any = prim "Any";
public type None = prim "None";
public type Null = prim "Null";
public type Bool = prim "Bool";
public type Nat = prim "Nat";
public type Nat8 = prim "Nat8";
public type Nat16 = prim "Nat16";
public type Nat32 = prim "Nat32";
public type Nat64 = prim "Nat64";
public type Int = prim "Int";
public type Int8 = prim "Int8";
public type Int16 = prim "Int16";
public type Int32 = prim "Int32";
public type Int64 = prim "Int64";
public type Float = prim "Float";
public type Char = prim "Char";
public type Text = prim "Text";
public type Blob = prim "Blob";
public type Error = prim "Error";
public type Principal = prim "Principal";
};

func abs(x : Int) : Nat { (prim "abs" : Int -> Nat) x };

// for testing
Expand Down