Types

The .prompt language has a type system that validates parameters and drives compile-time branching.

Type Categories

Type Lifecycle Notes
str Runtime Cannot drive branching
int Runtime Cannot drive branching
int[a..b] Compile-time Bounded integer
bool Compile-time Boolean
enum[a, b, c] Compile-time Single value from list
list[a, b, c] Compile-time Multiple values

Compile-Time vs Runtime

Types marked as compile-time can be used in if, case, and vary blocks. The compiler evaluates these at compile time and discards untaken branches.

Types marked as runtime cannot drive branching. They are injected into the compiled prompt but don't affect which branches are included.

Examples

String

params:
  @user_name: str

Integer

params:
  @age: int

Bounded Integer (for loop control)

params:
  @step: int[1..5]

Boolean

params:
  @is_premium: bool = false

Enum

params:
  @tier: enum[free, pro, enterprise] = free

List

params:
  @skills: list[communication, analysis, creativity]

Defaults

Parameters can have default values:

params:
  @depth: enum[shallow, medium, deep] = medium

Documentation

Add documentation with ->:

params:
  @name: str -> The user's display name
  @age: int[18..120] -> User's age (must be 18+)

Next Steps