Integrate some of the work done in psc-pages#1041
Integrate some of the work done in psc-pages#1041hdgarrood wants to merge 1 commit intopurescript:0.7-devfrom hdgarrood:integrate-pages
Conversation
|
Oh, also, to clarify - this code gets us part of the way towards fixing #747 but not all of the way there. It still needs to be wired up to
then the data type will still incorrectly appear in the list of instances for the type class. I think the solution would involve putting more information into the |
|
Oh, actually, maybe #747 should be fixed inside the compiler? This code already calls Come to think of it, on a similar note, perhaps |
|
Looks great, but I think I'd rather put the code under the Also, I'm not sure what the best plan of attack is w.r.t. |
|
Oh also, do you have plans to use this in |
|
I had assumed that this code would also become part of the library section of the Yes, I was planning to use this in |
|
Also, while I'm rearranging things like this, would you be ok with switching to Lucid for HTML generation? |
|
This now seems to work, with the code from The main difference I've noticed is that the generated code now has some redundant brackets in type signatures, where it didn't have them before. (The HTML output in psc-pages has this too; I hadn't noticed!) I suppose we might want to use Also, as it is currently, instances' docs (if any exist) are no longer displayed, based on the discussion we had in paf31/psc-pages#15, but if you only wanted that behaviour in |
|
I've now tested this with |
|
Cool, I'll review this today. Could you please rebase it though? |
There was a problem hiding this comment.
Can the exports be refined at all?
There was a problem hiding this comment.
Oh of course, sorry - will do.
There was a problem hiding this comment.
No worries. I'm just trying to check off a few things like this with new modules.
|
Sure, no problem. Should I squash all the commits? |
|
Yes please. I guess you would rebase from |
|
Yeah, or I can rebase from |
|
No, |
|
I didn't know about psc-pages before. Great idea! The Hoogle compatible stuff could be very useful 👍 |
|
@puffnfresh Yep, the plan is to integrate Pursuit with Hoogle for @hdgarrood's GSOC project :) |
|
Rebased and squashed, and I've also added explicit export lists and Haddock docs where appropriate. I think this is good to go. |
There was a problem hiding this comment.
Maybe later we can try to unify this with the existing prettyPrintType function. We could maybe write a "plain text renderer".
There was a problem hiding this comment.
I thought about doing this. Composing renderType with codeToString from the AsMarkdown module gets you most of the way there, there are just a couple of things that are not handled (eg Skolem).
There was a problem hiding this comment.
Just a word of warning - pattern-arrows will spin if a case isn't handled, effectively adding parens forever, so you'll want to make sure your base cases are exhaustive :)
|
Looks good. I'll merge this later when I do some work on 0.7. |
|
Arrghh, I messed up the rebase and somehow not all the changes I made to |
* Include a large chunk of code from psc-pages, allowing easier documentation output in multiple formats. * Rework psc-docs in order to use this new code. This makes psc-docs much simpler. * Partially fix #747, by putting instances in one chunk under their relevant data types and type classes. * Language.PureScript.Docs.RenderedCode now uses pattern-arrows in order to avoid unnecessary parentheses appearing in rendered code. * Remove unused code from psc-docs/Main.hs
|
I did some more work building on this, and (unfortunately) I think it's now in a position where if this PR is merged, my other work won't apply cleanly. So I've submitted it in a separate PR instead (#1055). |
Some context:
psc-docs), HTML (psc-pages), and as an input file for Hoogle (not really "documentation", but the process is very similar). The code I recently contributed to psc-pages splits the rendering into two stages, which makes it easy to render documentation in different forms in this way. In fact psc-pages can currently produce both HTML andMarkdownHoogle.It seems like the best way of accomplishing these 3 goals is to start looking at moving chunks of
psc-pagesinto the library part of thepurescriptpackage. This PR is a step in this direction.One small change I've made in this code that's not in the current
psc-pagescode, or even in the code in the open PR I have onpsc-pages, is that theRenderedDeclarationetc types now have comments asStringrather thanHtml- the code is the same, it just omits the final step transforming the comments into an HTML element. This allows us to output comments as Markdown, likepsc-docscurrently does, or as HTML.Also, I decided to base off of
0.7-dev, since #747 is marked for 0.7.0, but I can change this easily if you'd like.