From eea9d8f62761f0bc5c81021b3eaf0b63bd8045d5 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Mon, 8 Jun 2020 13:12:42 +0200 Subject: [PATCH] Move types to toplevel. --- gitlab-pages/docs/reference/big_map.md | 55 +---- gitlab-pages/docs/reference/bytes.md | 10 - gitlab-pages/docs/reference/crypto.md | 36 --- gitlab-pages/docs/reference/current.md | 76 ------ gitlab-pages/docs/reference/list.md | 12 - gitlab-pages/docs/reference/map.md | 53 +---- gitlab-pages/docs/reference/set.md | 10 - gitlab-pages/docs/reference/string.md | 12 - gitlab-pages/docs/reference/toplevel.md | 298 +++++++++++++++++++++++- 9 files changed, 315 insertions(+), 247 deletions(-) diff --git a/gitlab-pages/docs/reference/big_map.md b/gitlab-pages/docs/reference/big_map.md index 104751667..c844c8a6a 100644 --- a/gitlab-pages/docs/reference/big_map.md +++ b/gitlab-pages/docs/reference/big_map.md @@ -16,52 +16,6 @@ there are no `map`, `fold`, and `iter` operations as in The gast costs of big maps are higher than standard maps as data is lazily deserialized. - -type big_map ('key, 'value) - - -type ('key, 'value) big_map - - -type big_map ('key, 'value) - - - - -The type of a big map from values of type `key` to -values of type `value` is `big_map (key, value)`. - -```pascaligo group=big_map -type move is int * int -type register is big_map (address, move) -``` - - - - -The type of a big map from values of type `key` to values -of type `value` is `(key, value) big_map`. - -```cameligo group=big_map -type move = int * int -type register = (address, move) big_map -``` - - - - -The type of a big map from values of type `key` to -values of type `value` is `big_map(key, value)`. - -```reasonligo group=big_map -type move = (int, int); -type register = big_map(address, move); -``` - - - -Be aware that a `big_map` cannot appear inside another `big_map`. - function empty : big_map ('key, 'value) @@ -77,6 +31,9 @@ Create an empty big_map. ```pascaligo group=big_map +type move is int * int +type register is big_map (address, move) + const empty : register = Big_map.empty ``` @@ -90,6 +47,9 @@ const empty_alternative : register = big_map [] ```cameligo group=big_map +type move = int * int +type register = (address, move) big_map + let empty : register = Big_map.empty ``` @@ -97,6 +57,9 @@ let empty : register = Big_map.empty ```reasonligo group=big_map +type move = (int, int); +type register = big_map(address, move); + let empty: register = Big_map.empty ``` diff --git a/gitlab-pages/docs/reference/bytes.md b/gitlab-pages/docs/reference/bytes.md index 68e61d8cd..86326150c 100644 --- a/gitlab-pages/docs/reference/bytes.md +++ b/gitlab-pages/docs/reference/bytes.md @@ -8,16 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type bytes - - -type bytes - - -type bytes - - function concat : bytes -> bytes -> bytes diff --git a/gitlab-pages/docs/reference/crypto.md b/gitlab-pages/docs/reference/crypto.md index ba8d146fd..4d3b88dec 100644 --- a/gitlab-pages/docs/reference/crypto.md +++ b/gitlab-pages/docs/reference/crypto.md @@ -8,42 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type key - - -type key - - -type key - - -A public cryptographic key. - - -type key_hash - - -type key_hash - - -type key_hash - - -The hash of a public cryptographic key. - - -type signature - - -type signature - - -type signature - - -A cryptographic signature. - function blake2b : bytes -> bytes diff --git a/gitlab-pages/docs/reference/current.md b/gitlab-pages/docs/reference/current.md index 81cb3d48b..786bd56f4 100644 --- a/gitlab-pages/docs/reference/current.md +++ b/gitlab-pages/docs/reference/current.md @@ -8,80 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type timestamp - - -type timestamp - - -type timestamp - - -A date in the real world. - - -type tez - - -type tez - - -type tez - - -A specific type for tokens. - - -type address - - -type address - - -type address - - -An untyped address which can refer to a smart contract or account. - - -type contract('parameter) - - -type 'parameter contract - - -type contract('parameter) - - -A typed contract. - -Use `unit` as `parameter` to indicate an implicit account. - - -type operation - - -type operation - - -type operation - - -An operation emitted by the contract - - -type chain_id - - -type chain_id - - -type chain_id - - -The identifier of a chain, used to indicate test or main chains. - function balance : tez @@ -94,8 +20,6 @@ let balance: tez Get the balance for the contract. - - ```pascaligo diff --git a/gitlab-pages/docs/reference/list.md b/gitlab-pages/docs/reference/list.md index e85e5b543..3ed7a60c9 100644 --- a/gitlab-pages/docs/reference/list.md +++ b/gitlab-pages/docs/reference/list.md @@ -8,18 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type list ('t) - - -type 't list - - -type list('t) - - -A sequence of elements of the same type. - function length : nat diff --git a/gitlab-pages/docs/reference/map.md b/gitlab-pages/docs/reference/map.md index bf26f6bcf..37d30f2e3 100644 --- a/gitlab-pages/docs/reference/map.md +++ b/gitlab-pages/docs/reference/map.md @@ -8,50 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type map ('key, 'value) - - -type ('key, 'value) map - - -type map ('key, 'value) - - - - -The type of a map from values of type `key` to -values of type `value` is `map (key, value)`. - -```pascaligo group=maps -type move is int * int -type register is map (address, move) -``` - - - - -The type of a map from values of type `key` to values -of type `value` is `(key, value) map`. - -```cameligo group=maps -type move = int * int -type register = (address, move) map -``` - - - - -The type of a map from values of type `key` to -values of type `value` is `map (key, value)`. - -```reasonligo group=maps -type move = (int, int); -type register = map (address, move); -``` - - - function empty : map ('key, 'value) @@ -67,6 +23,9 @@ Create an empty map. ```pascaligo group=maps +type move is int * int +type register is map (address, move) + const empty : register = Map.empty ``` @@ -80,6 +39,9 @@ const empty : register = map [] ```cameligo group=maps +type move = int * int +type register = (address, move) map + let empty : register = Map.empty ``` @@ -87,6 +49,9 @@ let empty : register = Map.empty ```reasonligo group=maps +type move = (int, int); +type register = map (address, move); + let empty : register = Map.empty ``` diff --git a/gitlab-pages/docs/reference/set.md b/gitlab-pages/docs/reference/set.md index 9478a2048..22c725d61 100644 --- a/gitlab-pages/docs/reference/set.md +++ b/gitlab-pages/docs/reference/set.md @@ -10,16 +10,6 @@ import SyntaxTitle from '@theme/SyntaxTitle'; Sets are unordered collections of unique values of the same type. - -type set ('value) - - -type 'value set - - -type set('value) - - function empty : set('value) diff --git a/gitlab-pages/docs/reference/string.md b/gitlab-pages/docs/reference/string.md index afe9ebaa3..8a1b8ae51 100644 --- a/gitlab-pages/docs/reference/string.md +++ b/gitlab-pages/docs/reference/string.md @@ -8,18 +8,6 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; - -type string - - -type string - - -type string - - -A sequence of characters. - function length : string -> nat diff --git a/gitlab-pages/docs/reference/toplevel.md b/gitlab-pages/docs/reference/toplevel.md index 4858d5598..e82c43791 100644 --- a/gitlab-pages/docs/reference/toplevel.md +++ b/gitlab-pages/docs/reference/toplevel.md @@ -8,7 +8,303 @@ hide_table_of_contents: true import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; -These functions are available without any needed prefix. +These types and functions are available without any needed prefix. + + +type address + + +type address + + +type address + + +An untyped address which can refer to a smart contract or account. + + +type big_map ('key, 'value) + + +type ('key, 'value) big_map + + +type big_map ('key, 'value) + + + + +The type of a big map from values of type `key` to +values of type `value` is `big_map (key, value)`. + +```pascaligo group=big_map +type move is int * int +type register is big_map (address, move) +``` + + + + +The type of a big map from values of type `key` to values +of type `value` is `(key, value) big_map`. + +```cameligo group=big_map +type move = int * int +type register = (address, move) big_map +``` + + + + +The type of a big map from values of type `key` to +values of type `value` is `big_map(key, value)`. + +```reasonligo group=big_map +type move = (int, int); +type register = big_map(address, move); +``` + + + +Be aware that a `big_map` cannot appear inside another `big_map`. + + +type bool + + +type bool + + +type bool + + + +type bytes + + +type bytes + + +type bytes + + + + +type contract('parameter) + + +type 'parameter contract + + +type contract('parameter) + + +A typed contract. + +Use `unit` as `parameter` to indicate an implicit account. + + +type chain_id + + +type chain_id + + +type chain_id + + +The identifier of a chain, used to indicate test or main chains. + + +type int + + +type int + + +type int + + +An integer. + +The only size limit to integers is gas. + + +type key + + +type key + + +type key + + +A public cryptographic key. + + +type key_hash + + +type key_hash + + +type key_hash + + +The hash of a public cryptographic key. + + +type list ('t) + + +type 't list + + +type list('t) + + +A sequence of elements of the same type. + + +type map ('key, 'value) + + +type ('key, 'value) map + + +type map ('key, 'value) + + + + +The type of a map from values of type `key` to +values of type `value` is `map (key, value)`. + +```pascaligo group=maps +type move is int * int +type register is map (address, move) +``` + + + + +The type of a map from values of type `key` to values +of type `value` is `(key, value) map`. + +```cameligo group=maps +type move = int * int +type register = (address, move) map +``` + + + + +The type of a map from values of type `key` to +values of type `value` is `map (key, value)`. + +```reasonligo group=maps +type move = (int, int); +type register = map (address, move); +``` + + + + +type nat + + +type nat + + +type nat + + +A natural number. + +The only size limit to natural numbers is gas. + + +type operation + + +type operation + + +type operation + + +An operation emitted by the contract + + + +type set ('value) + + +type 'value set + + +type set('value) + + + +type signature + + +type signature + + +type signature + + +A cryptographic signature. + + + +type string + + +type string + + +type string + + +A sequence of characters. + + +type tez + + +type tez + + +type tez + + +A specific type for tokens. + + +type timestamp + + +type timestamp + + +type timestamp + + +A date in the real world. + + +type unit + + +type unit + + +type unit + + function is_nat: int -> option(nat)