JSON should be a standard library ADT, not a primitive type:
data Json {
JNull,
JBool(Bool),
JNumber(Float),
JString(String),
JArray(Array<Json>),
JObject(Map<String, Json>)
}
Parse and serialize operations belong in the standard library. Refinement types can express JSON schemas (e.g., type ApiResponse = { @Json | has_field(@Json.0, "status") }). This approach keeps the core language small while providing ergonomic JSON support.
Depends on: Standard library collections (#Map type).
Spec reference: spec/00-introduction.md § 0.8 "JSON as a Standard Library Type"
JSON should be a standard library ADT, not a primitive type:
Parse and serialize operations belong in the standard library. Refinement types can express JSON schemas (e.g.,
type ApiResponse = { @Json | has_field(@Json.0, "status") }). This approach keeps the core language small while providing ergonomic JSON support.Depends on: Standard library collections (#Map type).
Spec reference:
spec/00-introduction.md§ 0.8 "JSON as a Standard Library Type"