fn(type$0) =>
match $0 {
#type(_) =>
"type",
#number(_) =>
"number",
#float(_) =>
"float",
#string(_) =>
"string",
#boolean(_) =>
"boolean",
#secret(_) =>
"Secret",
#list(list$1) =>
@std.string-join(items: ["List<", @definy.type-ast-text(type: $1.item_type), ">"], separator: ""),
#code(quoted$2) =>
@std.string-join(items: ["Code<", @definy.type-ast-text(type: $2), ">"], separator: ""),
#function(function$3) =>
@std.string-join(
items: [
"(",
@definy.type-ast-arguments-text(arguments: $3.parameters),
") -> ",
@definy.type-ast-text(type: $3.return_type)
],
separator: ""
),
#record(fields$4) =>
@std.string-join(
items: [
"{ ",
@std.string-join(
items: @core.list-map(
T: Record{key: String, field_type: @core.type-ast},
U: String,
f: fn(item$5) =>
@std.string-join(items: [$5.key, ": ", @definy.type-ast-text(type: $5.field_type)], separator: ""),
xs: $4
),
separator: ", "
),
" }"
],
separator: ""
),
#union(variants$6) =>
@std.string-join(
items: @core.list-map(
T: Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}},
U: String,
f: fn(item$7) =>
match $7.payload_type {
#some(payload_type$8) =>
@std.string-join(items: [$7.tag, "(", @definy.type-ast-text(type: $8), ")"], separator: ""),
#none(_) =>
$7.tag
},
xs: $6
),
separator: " | "
),
#reference(reference$9) =>
@core.string-slice(value: $9.part_hash, start: 0, end: 8),
#parameter(name$10) =>
$10,
#apply(apply$11) =>
@std.string-join(
items: [
@core.string-slice(value: $11.part_hash, start: 0, end: 8),
"(",
@definy.type-ast-arguments-text(arguments: $11.arguments),
")"
],
separator: ""
),
#builtin(name$12) =>
match @definy.builtin-parameters-text(name: $12) {
#some(parameters$13) =>
@std.string-join(items: ["builtin ", $12, "(", $13, ")"], separator: ""),
#none(_) =>
@core.string-concat(left: "builtin ", right: $12)
}
}