Skip to content

Store more information in RenderedCode / refactoring#2550

Merged
hdgarrood merged 1 commit intomasterfrom
include-ident-namespace
Jan 19, 2017
Merged

Store more information in RenderedCode / refactoring#2550
hdgarrood merged 1 commit intomasterfrom
include-ident-namespace

Conversation

@hdgarrood
Copy link
Copy Markdown
Contributor

  • Changes the RenderedCodeElement type to preserve more information for
    creating links in RenderedCode values. In particular, the namespace of
    a symbol is now stored.
  • Refactor Docs.RenderedCode.Types so that the functions for creating
    RenderedCode values are easier to use and more type-safe.
  • Include information about the module that kinds are contained in in
    the RenderedCode renderer.
  • Split Docs.RenderedCode.Render into two modules:
    Docs.RenderedCode.RenderType and Docs.RenderedCode.RenderKind.

The JSON format has changed but in a backwards-compatible way. So once
this is released and Pursuit is updated with these changes, old
compilers will not be able to upload to Pursuit, but Pursuit will still
understand JSON produced by old compilers.

This gets us most of the way towards fixing purescript/pursuit#271 and purescript/pursuit#119.

@hdgarrood hdgarrood force-pushed the include-ident-namespace branch 2 times, most recently from 03bf32e to 9bb997e Compare January 8, 2017 10:53
@garyb
Copy link
Copy Markdown
Member

garyb commented Jan 8, 2017

The JSON format has changed but in a backwards-compatible way. So once this is released and Pursuit is updated with these changes, old compilers will not be able to upload to Pursuit, but Pursuit will still understand JSON produced by old compilers.

I'm not sure I understand this description of "backwards compatible" 😉 - is it that the uploads will start failing, but any existing "old" content will still work then?

dePrim ty@(TypeConstructor (Qualified _ name))
| ty == tyBoolean || ty == tyNumber || ty == tyString =
TypeConstructor $ Qualified Nothing name
dePrim other = other
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want to remove Prim. qualification anymore? Or is this handled somewhere else that I didn't notice now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is handled inside Pursuit, yeah. Really this function should never have been there at all, it was an oversight to include it. We want to keep this information in because we use it to generate links; see for example https://pursuit.purescript.org/packages/purescript-react/2.0.0/docs/React#t:KeyboardEvent - some of those are broken and I am fairly sure it is because of this function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, that totally makes sense! It was probably in here originally for psc-docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh just to clarify: psc-docs output shouldn't change as a result of this PR either. Also here's the part of Pursuit where this information is used, in case you're interested: https://github.com/purescript/pursuit/blob/681559794a31e3de18452124a718ab09c64aaec6/src/Model/DocsAsHtml.hs#L201-L216

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I wrote this code originally, and this module was mostly copied from Language.PureScript.Pretty.Types as it was at that time - of course this was the behaviour we wanted in prettyPrintType, but not what we wanted here, although I failed to realise that at the time.

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Yeah. Basically we don't have to try to regenerate the entire pursuit database, which is nice because that's a pain. I guess it's not fully backwards compatible but it is backwards compatible in the way that's most important from our point of view ;)

@garyb
Copy link
Copy Markdown
Member

garyb commented Jan 8, 2017

Got it 👍

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Oh wait a minute, I'm talking nonsense. Old compilers will still be able to upload to Pursuit!

* Changes the RenderedCodeElement type to preserve more information for
  creating links in RenderedCode values. In particular, the namespace of
  a symbol is now stored.
* Refactor Docs.RenderedCode.Types so that the functions for creating
  RenderedCode values are easier to use and more type-safe.
* Include information about the module that kinds are contained in in
  the RenderedCode renderer.
* Split Docs.RenderedCode.Render into two modules:
  Docs.RenderedCode.RenderType and Docs.RenderedCode.RenderKind.

The JSON format has changed but in a backwards-compatible way, so the
Pursuit database will not need to be regenerated.
@hdgarrood hdgarrood force-pushed the include-ident-namespace branch from 9c48d66 to 04d7668 Compare January 12, 2017 16:26
@hdgarrood
Copy link
Copy Markdown
Contributor Author

I force-pushed so that I could fix the erroneous commit message. Also no rush, but it would be nice to get this reviewed, as afterwards I can look at generating HTML docs in psc-docs, e.g. for generating docs from package sets.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jan 13, 2017

@garyb Did you already review this?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jan 14, 2017

Travis is passing now.

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Bump - is there anything I can do to make reviewing this easier?

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Thanks!

@hdgarrood hdgarrood merged commit fdc7bc8 into master Jan 19, 2017
@hdgarrood hdgarrood deleted the include-ident-namespace branch January 19, 2017 16:07
@garyb
Copy link
Copy Markdown
Member

garyb commented Jan 19, 2017

Sorry about the slow review :)

@hdgarrood
Copy link
Copy Markdown
Contributor Author

No worries, I appreciate that it was quite a big PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants