Request for Comments: Add new package "pandoc-codecs" #10996
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is exploratory work, aimed at improving the situation around JSON schemas (#9384) and command line options (#10163). It would include a good bit of busywork, so my intention is to gathering feedback with this PR before doing any of that.
The idea is to use autodocodec to define schemas for pandoc data types. These could then be reused in various places, e.g., to define a JSON schema, thus allowing us to keep all important definitions in one place. Or at least in fewer places, because we'd still be duplicating part of the ToJSON/FromJSON instances from
Text.Pandoc.Definition
, unless we decide to go all-in on autodocodec.I've put the code in a new package as to avoid an additional dependency in pandoc. Consistency checks for JSON encodings could happen via QuickCheck.
If this whole plan gets a tentative thumbs up, then my next step would be to write a
autodocodec-hslua
package that can use Codec definitions to do Lua marshaling.