Move types to toplevel.

This commit is contained in:
Sander Spies 2020-06-08 13:12:42 +02:00
parent b76d44e9f2
commit eea9d8f627
9 changed files with 315 additions and 247 deletions

View File

@ -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 The gast costs of big maps are higher than standard maps as data is lazily
deserialized. deserialized.
<SyntaxTitle syntax="pascaligo">
type big_map ('key, 'value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type ('key, 'value) big_map
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type big_map ('key, 'value)
</SyntaxTitle>
<Syntax syntax="pascaligo">
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)
```
</Syntax>
<Syntax syntax="cameligo">
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
```
</Syntax>
<Syntax syntax="reasonligo">
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);
```
</Syntax>
Be aware that a `big_map` cannot appear inside another `big_map`.
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function empty : big_map ('key, 'value) function empty : big_map ('key, 'value)
</SyntaxTitle> </SyntaxTitle>
@ -77,6 +31,9 @@ Create an empty big_map.
<Syntax syntax="pascaligo"> <Syntax syntax="pascaligo">
```pascaligo group=big_map ```pascaligo group=big_map
type move is int * int
type register is big_map (address, move)
const empty : register = Big_map.empty const empty : register = Big_map.empty
``` ```
@ -90,6 +47,9 @@ const empty_alternative : register = big_map []
<Syntax syntax="cameligo"> <Syntax syntax="cameligo">
```cameligo group=big_map ```cameligo group=big_map
type move = int * int
type register = (address, move) big_map
let empty : register = Big_map.empty let empty : register = Big_map.empty
``` ```
@ -97,6 +57,9 @@ let empty : register = Big_map.empty
<Syntax syntax="reasonligo"> <Syntax syntax="reasonligo">
```reasonligo group=big_map ```reasonligo group=big_map
type move = (int, int);
type register = big_map(address, move);
let empty: register = Big_map.empty let empty: register = Big_map.empty
``` ```

View File

@ -8,16 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function concat : bytes -> bytes -> bytes function concat : bytes -> bytes -> bytes
</SyntaxTitle> </SyntaxTitle>

View File

@ -8,42 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type key
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type key
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type key
</SyntaxTitle>
A public cryptographic key.
<SyntaxTitle syntax="pascaligo">
type key_hash
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type key_hash
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type key_hash
</SyntaxTitle>
The hash of a public cryptographic key.
<SyntaxTitle syntax="pascaligo">
type signature
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type signature
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type signature
</SyntaxTitle>
A cryptographic signature.
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function blake2b : bytes -> bytes function blake2b : bytes -> bytes
</SyntaxTitle> </SyntaxTitle>

View File

@ -8,80 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type timestamp
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type timestamp
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type timestamp
</SyntaxTitle>
A date in the real world.
<SyntaxTitle syntax="pascaligo">
type tez
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type tez
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type tez
</SyntaxTitle>
A specific type for tokens.
<SyntaxTitle syntax="pascaligo">
type address
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type address
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type address
</SyntaxTitle>
An untyped address which can refer to a smart contract or account.
<SyntaxTitle syntax="pascaligo">
type contract('parameter)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 'parameter contract
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type contract('parameter)
</SyntaxTitle>
A typed contract.
Use `unit` as `parameter` to indicate an implicit account.
<SyntaxTitle syntax="pascaligo">
type operation
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type operation
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type operation
</SyntaxTitle>
An operation emitted by the contract
<SyntaxTitle syntax="pascaligo">
type chain_id
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type chain_id
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type chain_id
</SyntaxTitle>
The identifier of a chain, used to indicate test or main chains.
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function balance : tez function balance : tez
</SyntaxTitle> </SyntaxTitle>
@ -94,8 +20,6 @@ let balance: tez
Get the balance for the contract. Get the balance for the contract.
<Syntax syntax="pascaligo"> <Syntax syntax="pascaligo">
```pascaligo ```pascaligo

View File

@ -8,18 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type list ('t)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 't list
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type list('t)
</SyntaxTitle>
A sequence of elements of the same type.
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function length : nat function length : nat
</SyntaxTitle> </SyntaxTitle>

View File

@ -8,50 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type map ('key, 'value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type ('key, 'value) map
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type map ('key, 'value)
</SyntaxTitle>
<Syntax syntax="pascaligo">
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)
```
</Syntax>
<Syntax syntax="cameligo">
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
```
</Syntax>
<Syntax syntax="reasonligo">
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);
```
</Syntax>
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function empty : map ('key, 'value) function empty : map ('key, 'value)
</SyntaxTitle> </SyntaxTitle>
@ -67,6 +23,9 @@ Create an empty map.
<Syntax syntax="pascaligo"> <Syntax syntax="pascaligo">
```pascaligo group=maps ```pascaligo group=maps
type move is int * int
type register is map (address, move)
const empty : register = Map.empty const empty : register = Map.empty
``` ```
@ -80,6 +39,9 @@ const empty : register = map []
<Syntax syntax="cameligo"> <Syntax syntax="cameligo">
```cameligo group=maps ```cameligo group=maps
type move = int * int
type register = (address, move) map
let empty : register = Map.empty let empty : register = Map.empty
``` ```
@ -87,6 +49,9 @@ let empty : register = Map.empty
<Syntax syntax="reasonligo"> <Syntax syntax="reasonligo">
```reasonligo group=maps ```reasonligo group=maps
type move = (int, int);
type register = map (address, move);
let empty : register = Map.empty let empty : register = Map.empty
``` ```

View File

@ -10,16 +10,6 @@ import SyntaxTitle from '@theme/SyntaxTitle';
Sets are unordered collections of unique values of the same type. Sets are unordered collections of unique values of the same type.
<SyntaxTitle syntax="pascaligo">
type set ('value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 'value set
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type set('value)
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function empty : set('value) function empty : set('value)
</SyntaxTitle> </SyntaxTitle>

View File

@ -8,18 +8,6 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
<SyntaxTitle syntax="pascaligo">
type string
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type string
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type string
</SyntaxTitle>
A sequence of characters.
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function length : string -> nat function length : string -> nat
</SyntaxTitle> </SyntaxTitle>

View File

@ -8,7 +8,303 @@ hide_table_of_contents: true
import Syntax from '@theme/Syntax'; import Syntax from '@theme/Syntax';
import SyntaxTitle from '@theme/SyntaxTitle'; import SyntaxTitle from '@theme/SyntaxTitle';
These functions are available without any needed prefix. These types and functions are available without any needed prefix.
<SyntaxTitle syntax="pascaligo">
type address
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type address
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type address
</SyntaxTitle>
An untyped address which can refer to a smart contract or account.
<SyntaxTitle syntax="pascaligo">
type big_map ('key, 'value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type ('key, 'value) big_map
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type big_map ('key, 'value)
</SyntaxTitle>
<Syntax syntax="pascaligo">
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)
```
</Syntax>
<Syntax syntax="cameligo">
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
```
</Syntax>
<Syntax syntax="reasonligo">
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);
```
</Syntax>
Be aware that a `big_map` cannot appear inside another `big_map`.
<SyntaxTitle syntax="pascaligo">
type bool
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type bool
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type bool
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type bytes
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo">
type contract('parameter)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 'parameter contract
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type contract('parameter)
</SyntaxTitle>
A typed contract.
Use `unit` as `parameter` to indicate an implicit account.
<SyntaxTitle syntax="pascaligo">
type chain_id
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type chain_id
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type chain_id
</SyntaxTitle>
The identifier of a chain, used to indicate test or main chains.
<SyntaxTitle syntax="pascaligo">
type int
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type int
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type int
</SyntaxTitle>
An integer.
The only size limit to integers is gas.
<SyntaxTitle syntax="pascaligo">
type key
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type key
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type key
</SyntaxTitle>
A public cryptographic key.
<SyntaxTitle syntax="pascaligo">
type key_hash
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type key_hash
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type key_hash
</SyntaxTitle>
The hash of a public cryptographic key.
<SyntaxTitle syntax="pascaligo">
type list ('t)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 't list
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type list('t)
</SyntaxTitle>
A sequence of elements of the same type.
<SyntaxTitle syntax="pascaligo">
type map ('key, 'value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type ('key, 'value) map
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type map ('key, 'value)
</SyntaxTitle>
<Syntax syntax="pascaligo">
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)
```
</Syntax>
<Syntax syntax="cameligo">
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
```
</Syntax>
<Syntax syntax="reasonligo">
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);
```
</Syntax>
<SyntaxTitle syntax="pascaligo">
type nat
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type nat
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type nat
</SyntaxTitle>
A natural number.
The only size limit to natural numbers is gas.
<SyntaxTitle syntax="pascaligo">
type operation
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type operation
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type operation
</SyntaxTitle>
An operation emitted by the contract
<SyntaxTitle syntax="pascaligo">
type set ('value)
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type 'value set
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type set('value)
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo">
type signature
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type signature
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type signature
</SyntaxTitle>
A cryptographic signature.
<SyntaxTitle syntax="pascaligo">
type string
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type string
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type string
</SyntaxTitle>
A sequence of characters.
<SyntaxTitle syntax="pascaligo">
type tez
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type tez
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type tez
</SyntaxTitle>
A specific type for tokens.
<SyntaxTitle syntax="pascaligo">
type timestamp
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type timestamp
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type timestamp
</SyntaxTitle>
A date in the real world.
<SyntaxTitle syntax="pascaligo">
type unit
</SyntaxTitle>
<SyntaxTitle syntax="cameligo">
type unit
</SyntaxTitle>
<SyntaxTitle syntax="reasonligo">
type unit
</SyntaxTitle>
<SyntaxTitle syntax="pascaligo"> <SyntaxTitle syntax="pascaligo">
function is_nat: int -> option(nat) function is_nat: int -> option(nat)