Skip to content

Commit 6a71bbe

Browse files
committed
Remove mention of GhcHint; add portion for later work
1 parent c9d328c commit 6a71bbe

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

proposals/0000-specify-dump-json.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ The output of the JSON dump would consist of a list of errors, as well as a top
103103
- required by the schema
104104
- `"code"` corresponding to the change in this [proposal](https://github.com/haskellfoundation/tech-proposals/blob/main/proposals/accepted/024-error-messages.md) and the above `DiagnosticCode` in typeclass `Diagnostic`
105105
- this is required by the schema but is allowed to have a value of `null`. The hope is that once all diagnostics officially have error codes, this can be required and nonnullable, but that will happen once `diagnosticCode` itself doesn't return a `DiagnosticCode` wrapped in a `Maybe`
106-
- `"hints"` corresponding to the above `[GhcHint]`
107-
- While these are required by the schema, `[]` is an allowed value
108-
- The schema itself doesn't validate at all what these may be, only that they are themselves objects. In my view, the best way to handle them is to output a JSON-ified version of the type `GhcHint`. Any attempt to specify them more than that will result in spiraling complexity and a required update every time the `GhcHint` type changes. Another alternative is to just remove them from the output and only present suggestions as they are rendered in the `message`.
109106
- `"message"` corresponding to `DecoratedSDoc` of `diagnosticMessage`
110107
- this is required by the schema, and is the actual string output produced at the command line
111108

@@ -133,7 +130,6 @@ For demonstrative purposes, here is an example valid instance of the schema.
133130
},
134131
"severity": "Error",
135132
"code": 27958,
136-
"hints": [],
137133
"message": " • Couldn't match type ‘b0’ with ‘(Bool, b0)’ \n Expected: b0 -> Maybe (Bool, b0) \nActual: b0 -> Maybe b0 \n• In the first argument of ‘unfoldr’, namely ‘Just’ \nIn the expression: unfoldr Just \nIn an equation for ‘f’: f = unfoldr Just"
138134
}
139135
]
@@ -160,3 +156,16 @@ I believe the Haskell community would benefit as a whole from improved tooling,
160156
## Success
161157

162158
I expect the implementation to take no more than 2 or so months. The project will be considered a success when an appropriate JSON dump flag is shipped with GHC which serves the purpose of providing a JSON structured representation of error messages which complies with a JSON schema in version control.
159+
160+
## Future Work
161+
162+
Besides the obvious requirement of maintenance of this feature, there are also some opportunities for future work worth flagging here.
163+
The first is the presentation of `GhcHint` type in the JSON message.
164+
As it stands now, the best practice for encoding these in the JSON output is not obvious and requires further discussion.
165+
Therefore, it is better to push forward an initial implementation containing the above mentioned fields.
166+
The inclusion of `GhcHint` can then be better explored once the use cases of the JSON output are better understood and consumers can be consulted.
167+
168+
Additionally, there is work to provide a simple Haskell library which parses the output of the JSON dump.
169+
Such a library would facilitate easier consumption of the output for those interested in writing applications in Haskell without using the GHC API.
170+
171+
These plans are contingent on the completion of the above matters.

proposals/0000-specify-dump-json/schema.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@
3535
"null"
3636
]
3737
},
38-
"hints": {
39-
"description": "The hints suggested by GHC in a JSON-ified representation of the internal GhcHint type",
40-
"type": "array",
41-
"items": {
42-
"type": "object"
43-
}
44-
},
4538
"message": {
4639
"description": "The string output of the diagnostic message by GHC",
4740
"type": "string"
@@ -51,7 +44,6 @@
5144
"span",
5245
"severity",
5346
"code",
54-
"hints",
5547
"message"
5648
],
5749
"additionalProperties": false

0 commit comments

Comments
 (0)