What is the best way to go about manipulating/extending an ADT that isn’t under your control? (ie from a dependency)
Here is the data type that relates to my problem:
I want to maintain the structure of the data, but add additional data (ie adding another type), but the structure itself is not under my control. Do I have to map the data over to my own version of this definition?
For example, for all the paragraphs in the structure, I would like Para to become Para [Inline] [String] where [String] is a list of words contained in the paragraph (as it's own data structure).
I am serving this data up as JSON via an endpoint, I thought one way I could get around this would be to define my own ToJSON instance, and perform this translation on Para there, however I am unable to override the instance as it is already defined! I am willing to accept a solution that does not actually touch the Para type itself, I just need a way to couple more data to Para without losing any of the structure of full Pandoc document.