Expand description
JSON diagnostic output format.
This module provides machine-readable JSON output for diagnostics, compatible with IDE tooling and CI systems.
§Format
The output format is designed to be compatible with common conventions:
{
"message": "error message",
"code": "E0001",
"severity": "error",
"spans": [
{
"file": "src/main.hs",
"line_start": 10,
"line_end": 10,
"column_start": 5,
"column_end": 15,
"is_primary": true,
"label": "expected Int, found String"
}
],
"notes": ["consider using show"],
"suggestions": [
{
"message": "try this",
"replacement": "show x"
}
]
}Structs§
- Json
Diagnostic - A diagnostic in JSON format.
- Json
Span - A source span in JSON format.
- Json
Suggestion - A suggested fix in JSON format.
Enums§
- Json
Applicability - Applicability in JSON format.
- Json
Severity - Severity level in JSON format.
Functions§
- diagnostic_
to_ json - Convert a diagnostic to JSON format.
- diagnostics_
to_ json - Convert multiple diagnostics to JSON format.
- to_
json_ lines - Serialize diagnostics to a JSON string (compact, one per line).
- to_
json_ string - Serialize diagnostics to a JSON string.