Skip to content
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

show else prefix for instance chain items in docs #3715

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

csicar
Copy link

@csicar csicar commented Aug 9, 2019

Fix for Issue #3605

  • test complete successfully

example:
example

Changes

  • added Bool to ChildInstance Constructor
  • added chained to JSON representation, with default value False for backwards-compatability
  • added rendering for else keyword

Notes

Displaying the instances of a type can look weird because the else prefix has no meaning there. I would suggest hiding the else keyword when displaying anywhere except a type class context
weird case

@hdgarrood
Copy link
Contributor

Displaying the instances of a type can look weird because the else prefix has no meaning there. I would suggest hiding the else keyword when displaying anywhere except a type class context

Yes please, good call.

@csicar
Copy link
Author

csicar commented Aug 18, 2019

The solution in bc3cc4e is not very elegant, but works. Basically the problem is, that rendering of the ChildDeclaration needs to know if the parent declaration is a TypeClass.

Alternatively, I could pass the Parent declaration to Renderer.renderChildDeclaration, which might be nicer (depending on preference).

@hdgarrood
Copy link
Contributor

This is actually quite a bit more subtle than I first expected. I think what we have here is still not quite right, for a couple of reasons:

  1. It could be misleading to display an instance from a chain outside of the context of that chain. If we were to display an instance which is halfway down a chain without the instances above it in the chain, it would appear that this instance would be selected more often than it actually is.
  2. It's possible that a particular data type appears more than once in an instance chain, in which case all of the instances in that chain mentioning that type would not appear to be chained, even though they should be.

I'm trying to come up with some convincing examples. I think the correct approach here may be to represent the entire chain as a single ChildDeclaration, and to include the entire chain on the instance list of data types whenever the data type appears at least once anywhere in the chain.

@csicar csicar force-pushed the purescript-docs-instance-chain branch from bc3cc4e to 7943881 Compare October 4, 2020 17:51
@csicar
Copy link
Author

csicar commented Oct 4, 2020

New version is improved in pretty much every way:

  • Type Class instances are now modeled as a List
  • JSON is broken in an backward-compatible way
    • make sure reading old json will generate correct html
  • references are working & instance chain can now be referenced by their instanceId in HTML (For instance chain of instanceA instanceB the id is instanceA-else-InstnaceB)

TODO:

  • fix sourceAnn and comments for instance chains
  • test Markdown

@csicar csicar force-pushed the purescript-docs-instance-chain branch from c00e543 to b8805c8 Compare October 4, 2020 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants