-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Use ADT to represent input formats #5118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Experimental approach to formalizing formats. Pros:
Cons:
|
|
Wow, this is a lot of code! I'm not sure yet what I think -- I haven't had time to look at it all. Can you say more about what problem this solves, or what problem motivated it? One small comment: since Also: there's an issue somewhere for making |
|
Sorry for dumping such a large chunk of code. I wanted to do a small edit, but then kept making changes to ensure the approach to be sensible in a bigger context (my first two approaches turned out to be bad). The main driver for this change is the idea to expose functions like So what I'm looking for is a function So this PR started as an edit to I added separate constructors for all markdown types because the format is passed to filters; filters would no longer have the ability to distinguish between |
|
I forgot an important piece: I'd like |
|
I've rebased the PR, downsized its scope, and made it backwards compatible. It now just shows the general idea, but applies it only in selected parts of the code base. My plan would be to iterate on this after (if) this PR gets merged:
|
e1d4f7a to
e0342a8
Compare
|
The downside of this approach is that steps 1 and 2 would lead to moderate code duplication. But that would then disappear again with step 3. |
A new module Text.Pandoc.Format.Input is added and exposed to library users. Types supported as input format can be represented as value of the *InputFormat* type.
|
This is outdated, and some useful parts of this approach have already made it into the code. Closing. |
A new module Text.Pandoc.Format is added and exposed to library users.
Types supported as input and/or output format can be described via value
of the KnownFormat type. The submodule
Text.Pandoc.Format.KnownFormatis hidden, but re-exported through itsparent module.
Text.Pandoc.Extensions is made a submodule of Text.Pandoc.Format.
The Extensions module is now hidden, but re-exported through
Text.Pandoc.Format.