From 3e46e226c03f609a10708eeff2e75be186eaef63 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Wed, 1 Apr 2020 19:00:39 +0200 Subject: [PATCH 1/2] Add toplevel page for API reference. --- gitlab-pages/docs/reference/toplevel.md | 86 +++++++++++++++++++++++++ gitlab-pages/website/sidebars.json | 1 + 2 files changed, 87 insertions(+) create mode 100644 gitlab-pages/docs/reference/toplevel.md diff --git a/gitlab-pages/docs/reference/toplevel.md b/gitlab-pages/docs/reference/toplevel.md new file mode 100644 index 000000000..c8b819a81 --- /dev/null +++ b/gitlab-pages/docs/reference/toplevel.md @@ -0,0 +1,86 @@ +--- +id: toplevel +title: Toplevel +description: Available functions at the top level +hide_table_of_contents: true +--- + +import Syntax from '@theme/Syntax'; +import SyntaxTitle from '@theme/SyntaxTitle'; + +These functions are available without any needed prefix. + + +function is_nat: int -> option(nat) + + +val is_nat: int -> nat option + + +let is_nat: int => option(nat) + + +Convert an `int` to a `nat` if possible. + + +function abs: int -> nat + + +val abs: int -> nat + + +let abs: int => nat + + +Cast an `int` to `nat`. + + +function int: nat -> int + + +val int: nat -> int + + +let int: nat => int + + +Cast an `nat` to `int`. + + +const unit: unit + + +val unit: unit + + +let (): unit + + +A helper to create a unit. + + +function failwith : string -> unit + + +function failwith : string -> unit + + +function failwith : string -> unit + + +Cause the contract to fail with an error message. + +> ⚠ Using this currently requires in general a type annotation on the +> `failwith` call. + + +function assert : bool -> unit + + +function assert : bool -> unit + + +function assert : bool -> unit + + +Check if a certain condition has been met. If not the contract will fail. diff --git a/gitlab-pages/website/sidebars.json b/gitlab-pages/website/sidebars.json index 36cff21e1..fd1773701 100644 --- a/gitlab-pages/website/sidebars.json +++ b/gitlab-pages/website/sidebars.json @@ -26,6 +26,7 @@ "api/cheat-sheet" ], "API":[ + "reference/toplevel", "reference/big-map-reference", "reference/bitwise-reference", "reference/bytes-reference", From d0094addd2aa6d239dea69ac89ba173ec52ad65f Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 2 Apr 2020 12:40:55 +0200 Subject: [PATCH 2/2] Add markdown files to md_file_tests --- src/test/md_file_tests.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 6114e9126..40ba43072 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -124,6 +124,9 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/toplevel.md"; + "/gitlab-pages/docs/reference/bitwise.md"; + "/gitlab-pages/docs/reference/bytes.md"; "/gitlab-pages/docs/reference/list.md"; "/gitlab-pages/docs/reference/map.md"; "/gitlab-pages/docs/reference/set.md";