-
Notifications
You must be signed in to change notification settings - Fork 241
--show-interface
appears to be encoded in Json, but the doc
part is raw Haskell show
output!
#920
Comments
I doubt anybody's actually programmatically using the
I think the right way to do this is via |
@harpocrates Thank you for answering, Alec! why not read the binary interfaces directly I want a single compiled instance of my application to work across multiple versions of Haddock. So, I would much rather call the on manually reading the json I do not understand why you think that "manually reading the JSON" will be harder when it is actually JSON, rather than some arbitrary mix of JSON and internal representation. Can you elaborate on this? Actually, do you mean "manually writing a JSON parser" or "human reading JSON from screen"? on my further action What is my further action? Do I need to wait for more commentary, or should I start working on option A? |
More of the latter. I use I think you should wait for @alexbiehl's take on this. |
@alexbiehl @harpocrates I am waiting, but it has been almost a year! |
@kindaro I think it is safe to say no one else is going to comment. I personally think we should go with option A. Even when I debug with them (JSON dumps of interface files), it is programmatic. Are you still interested in doing this? |
@harpocrates Better late than never! It is not at the moment my highest priority, but I promise to create a pull request within a month from now. |
@harpocrates Delivered! See #1159. |
Fixed in d8aaaba. |
Try it yourself:
Consider the following example module:
Let us obtain a Json representation of its haddock:
What we will see is this:
Everything looks nice and tidy, except that the
doc
section appears to be ashow
output. Upon inspection, indeed:Haddock.Interface.Json
I do not exactly understand what the
bimap
is doing, but I am certainly unhappy with the overall approach.Why is it a problem:
I want to programmatically access the contents of haddocks. From the fact that
--show-interface
outputs Json, I had an impression that it promises cross language interoperability. But hardly can I make a use of thedoc
field as it is currently presented, with Haskell-specific syntax.haddock-library
(from which, as I researched, the string originates) or maintain a duplicate of a 27 constructor long data type.DocH
is not an instance ofRead
. But with Haskell, I could probably standalone derive it.What can be done:
I see two ways we can go from here:
A. Write a more comprehensive
jsonDoc
function, and even ajsonDocH
function to accompany it.B. Write or derive an
instance Read DocH
.DocH
representation may change at any time.haddock-library
.C. Do nothing, wontfix.
Pros:
Cons:
I am anxious to hear from the maintainers. If there is consensus, I can craft a pull request in no time.
The text was updated successfully, but these errors were encountered: