Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Default signatures #938

Merged
merged 8 commits into from
Sep 11, 2018
Merged

Default signatures #938

merged 8 commits into from
Sep 11, 2018

Conversation

harpocrates
Copy link
Collaborator

Adds back rendering of default methods. While I was at it, I also cherry-picked some old un-merged changes to improve the rendering of: default methods & default associated types (in the XHTML backend) and default methods (in the LaTeX backend).

Note there is still some GHC-side work that needs to be done to collect docs on default methods and default associated types. However, this solves the more urgent problem that we currently aren't rendering anything related to defaults.

blmage and others added 7 commits September 10, 2018 18:39
...when the other method is let through.
There is still no plan for documenting these though.
A while back, class methods changed from 'TypeSig' -> 'ClassOpSig'.
I also took the opportunity to at least render default signatures.
@harpocrates
Copy link
Collaborator Author

In case it isn't clear, this really a bug fix (although I ended up improving the output along the way too). This is what wip/hi-haddock currently produces for the Binary class from binary:

screen shot 2018-09-10 at 7 44 24 pm

Here is what this branch produces instead:

screen shot 2018-09-05 at 6 50 50 am


Here is the output of the test cases I added:

XHTML default signatures

screen shot 2018-09-10 at 7 31 38 pm

XHTML default associated types

screen shot 2018-09-10 at 7 31 32 pm

LaTeX default signatures

screen shot 2018-09-10 at 7 31 10 pm

Copy link
Member

@sjakobi sjakobi left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, Alec! :)

I have some minor comments.

@@ -72,14 +73,14 @@ ppLFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName ->
[Located DocName] -> LHsType DocNameI -> [(DocName, Fixity)] ->
Splice -> Unicode -> Maybe Package -> Qualification -> Html
ppLFunSig summary links loc doc lnames lty fixities splice unicode pkg qual =
ppFunSig summary links loc doc (map unLoc lnames) lty fixities
ppFunSig summary links loc mempty doc (map unLoc lnames) lty fixities
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have something more explicit than mempty here.

@@ -226,7 +227,7 @@ ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName
-> Splice -> Unicode -> Maybe Package -> Qualification -> Html
ppFor summary links loc doc (ForeignImport _ (L _ name) typ _) fixities
splice unicode pkg qual
= ppFunSig summary links loc doc [name] (hsSigType typ) fixities splice unicode pkg qual
= ppFunSig summary links loc mempty doc [name] (hsSigType typ) fixities splice unicode pkg qual
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

@@ -503,7 +504,7 @@ ppShortClassDecl summary links (ClassDecl { tcdCtxt = lctxt, tcdLName = lname, t

-- ToDo: add associated type defaults

[ ppFunSig summary links loc doc names (hsSigType typ)
[ ppFunSig summary links loc mempty doc names (hsSigType typ)
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

uniquifyClassSig _ = liftA2 setName (updateName . getName) id
where
updateName = liftA2 setNameUnique id $
liftA2 deriveUnique id ((+1) . getKey) . nameUnique
Copy link
Member

Choose a reason for hiding this comment

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

I see several issues with this function but it doesn't appear to be used at all?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hah, nice catch! I thought this was funky too: #822 (comment). This snuck in through the cherry-picked commits.

* remove unused (and buggy) function
* 'mempty' -> 'noHtml'
@sjakobi sjakobi merged commit ba9176a into haskell:wip/hi-haddock Sep 11, 2018
@harpocrates harpocrates deleted the defaults branch September 11, 2018 03:47
@harpocrates harpocrates mentioned this pull request Sep 13, 2019
4 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants