fix "types.md"

This commit is contained in:
Lesenechal Remi 2019-12-25 22:53:40 +01:00
parent afa61e5825
commit 3d925ae43e

View File

@ -59,12 +59,12 @@ let ledger: account_balances = Map.literal
<!--ReasonLIGO--> <!--ReasonLIGO-->
```reasonligo ```reasonligo
/* account_balances is a simple type, a map of address <-> tez */ (* account_balances is a simple type, a map of address <-> tez *)
type account_balances = map(address, tez); type account_balances = map(address, tez);
let ledger: account_balances = let ledger: account_balances =
Map.literal([ Map.literal([
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, 10mutez), ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, 10mutez)
]); ]);
``` ```
@ -124,25 +124,23 @@ let ledger: account_balances = Map.literal
<!--ReasonLIGO--> <!--ReasonLIGO-->
```reasonligo ```reasonligo
/* alias two types */ (* alias two types *)
type account = address; type account = address;
type number_of_transactions = nat; type number_of_transactions = nat;
/* account_data consists of a record with two fields (balance, number_of_transactions) */ (* account_data consists of a record with two fields (balance, number_of_transactions) *)
type account_data = { type account_data = {
balance: tez, balance: tez,
number_of_transactions, number_of_transactions,
}; };
/* our ledger / account_balances is a map of account <-> account_data */ (* our ledger / account_balances is a map of account <-> account_data *)
type account_balances = map(account, account_data); type account_balances = map(account, account_data);
/* pseudo-JSON representation of our map */ (* pseudo-JSON representation of our map
/* {"tz1...": {balance: 10mutez, number_of_transactions: 5n}} */ {"tz1...": {balance: 10mutez, number_of_transactions: 5n}} *)
let ledger: account_balances = let ledger: account_balances =
Map.literal([ Map.literal([
( ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address,
"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, {balance: 10mutez, number_of_transactions: 5n})
{balance: 10mutez, number_of_transactions: 5n},
),
]); ]);
``` ```