Learn
Core Concepts
The smallest useful model of the Pkl language.
Core Concepts
Modules
A module is the top-level unit. Top-level properties evaluate to an object-shaped value, and imports let one module reuse the values exported by another.
module demoname = "api"port = 8080Objects
Objects are named member collections. Member lookup works for both explicit object literals and module results.
bird = new { name = "hawk"}bird.nameConstraints
Pkl supports constraints as part of typed module design, including isBetween,
isPositive, isGreaterThan, isLessThan, negation, and plain-function
predicate factories.
const function above(n) = (x) -> x > nclass Service { replicas: Int(above(0))}Imports
Imports connect modules into a source graph. Keep imported modules small enough that the relationship is obvious from the importing file.