Data Types

Primitive Types

Field

Field arithmetic (main type for ZK circuits)

let x: field = 42;

Boolean

let x: Bool = true;

Unit Type

Empty type (used by assertions)

()

Composite Types

Arrays

Lof don’t supports modification in-place of Arrays

array<Field, 3>    // Array of 3 fields elements

array<Bool, 5>     // Array of 5 booleans
[1, 2, 3]          // Creates array<Field, 3>

let first = arr[0] // Get first element

Tuples

(Field, Bool)               // Pair of field and boolean
(Field, Field, Field)       // Triple of fields

(42, true)                  // Creates (Field, Bool)
(100, 200, 300)             // Creates (Field, Field, Field)

Custom Types

Type aliases

type Balance = Field;
type UserId = Field;
type Point = (Field, Field);

let account_balance: Balance = 1000;
let user: UserId = 12345;
let location: Point = (50, 75)

Function Types

Function Signatures

square : (Field) -> Field
add : (Field, Field) -> Field

multiply : (Field, Field) -> Field

ZK Circuit Types

Signals

proof Example {
    input public_value: Field      // Known to verifier
    witness secret_value: Field    // Known only to prover

    // proof logic here
}

Bit representations

Bits<size>                         // Bit arrays for circuit operations