FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

show `else` prefix for instance chain items in docs by csicar · Pull Request #3715 · purescript/purescript · GitHub

show else prefix for instance chain items in docs - #3715

Open
csicar wants to merge 7 commits into
purescript:masterfrom
csicar:purescript-docs-instance-chain
Open

show else prefix for instance chain items in docs#3715
csicar wants to merge 7 commits into
purescript:masterfrom
csicar:purescript-docs-instance-chain

Conversation

csicar commented Aug 9, 2019

Copy link
Copy Markdown

Fix for Issue #3605

  • test complete successfully

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

Copy link
Copy Markdown
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 commented Aug 18, 2019

Copy link
Copy Markdown
Author

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).

Copy link
Copy Markdown
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 force-pushed the purescript-docs-instance-chain branch from bc3cc4e to 7943881 Compare October 4, 2020 17:51

csicar commented Oct 4, 2020
edited
Loading

Copy link
Copy Markdown
Author

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 force-pushed the purescript-docs-instance-chain branch from c00e543 to b8805c8 Compare October 4, 2020 22:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL