-
Notifications
You must be signed in to change notification settings - Fork 237
Show where instances are defined #748
Show where instances are defined #748
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really useful! Thanks Alec.
@@ -388,7 +388,7 @@ mkPseudoFamilyDecl (FamilyDecl { .. }) = PseudoFamilyDecl | |||
|
|||
|
|||
-- | An instance head that may have documentation and a source location. | |||
type DocInstance name = (InstHead name, Maybe (MDoc (IdP name)), Located (IdP name)) | |||
type DocInstance name = (InstHead name, Maybe (MDoc (IdP name)), Located (IdP name), Maybe Module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is a breaking change :( This has to go into the next major version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspected as much... Should I reopen this PR on ghc-head
then?
where | ||
pdata = keyword "data" <+> typ | ||
pdecl = pdata <+> ppShortDataDecl False True dd [] unicode qual | ||
where | ||
mname = maybe noHtml (\m -> hsep [toHtml "(Defined in", ppModule m, toHtml ")"]) mdl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave out the parenthesis, they look bad and are completely unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
a727a19
to
f6b36d5
Compare
Above instance, we now also display a link to the module where the instance was defined. This is sometimes helpful in figuring out what to import.
f6b36d5
to
0352997
Compare
@alexbiehl Gentle ping on this. If you are waiting to merge this after #721, that's fine - I just want to make sure this isn't forgotten. Once this gets merged, I'll also fix the tests on #749. |
Alec, sorry. I didn't notice you pushed an update to this one. Merging right away. |
* Indicate source module of instances Above instance, we now also display a link to the module where the instance was defined. This is sometimes helpful in figuring out what to import. * Source module for type/data families too * Remove parens * Accept tests
* Indicate source module of instances Above instance, we now also display a link to the module where the instance was defined. This is sometimes helpful in figuring out what to import. * Source module for type/data families too * Remove parens * Accept tests (cherry picked from commit b7a74c6)
This is analogous to what GHCi's
:info
command does - it displays in the instance details where the instance was defined.Here is a snippet of the instances for
Bool
(Note the "(Defined in ...)" links):This fixes #296 as much as it can ever really hope to be fixed.