dazl

BasicsΒΆ

Mapping DAML types to Python types

DAML type

Python type

Unit or ()

dict() (an empty dictionary)

Bool

bool

Integer or Int

int

Decimal

decimal.Decimal

Text

str

Party

str

RelTime

datetime.timedelta

Date

datetime.datetime

Time

datetime.time

ContractId a

dazl.model.core.ContractId

List a

list

records

dict where keys are field names and values are as listed in this table

variants

dict containing a single key naming the specific constructor to use, and value as listed in this table

Some examples

The examples below are valid for the following DAML:

data Rectangle = Rectangle with
    length: Decimal
    width: Decimal

data Expr a = Num a
            | Product (Expr a) (Expr a)
            | Sum (Expr a) (Expr a)

template CalculateRequest
  with
    requester: Party
    computer: Party
    expression: Expr Decimal

template CalculateResponse
  with
    requester: Party
    computer: Party
    value: Decimal