-
Notifications
You must be signed in to change notification settings - Fork 278
implement dependents <x>
, dependencies <x>
, and debug.file
#1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
-- this definition is identical to the previous one, apart from the word | ||
-- "Dependencies", but undecided about whether or how to refactor |
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.
¯\_(ツ)_/¯
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.
Suggestion: I'd do column2sep
(you'll have to write it, can pattern after column3sep
, just add sep
before the right column) to add an extra space between the columns, and I'd also add a header:
P.column2Sep " " $ [ (P.hiBlack "Hash", P.hiBlack "Name") ] ++ ...
Or maybe better yet, add a column2Header : Pretty -> Pretty -> [(Pretty, Pretty)] -> Pretty
that encapsulates this pattern of adding a header.
It's also okay as is if you are out of steam, but I had a hard time parsing the current output and think above suggestion might help.
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.
Looks good. Can you either do the following as part of this PR or create tickets to track the following (and if you disagree on any of these being a good idea LMK) -
- Make
dependents
anddependencies
commands produce numbered output - Add a transcript test (once the commands produce numbered output, create simple transcript to exercise)
- Make these commands produce output just like
find
- show type signatures and whatnot
No need to address any/all of those in this PR I don't think, unless you are feeling inspired.
I left one other minor formatting suggestion on the output, also optional I think.
-- this definition is identical to the previous one, apart from the word | ||
-- "Dependencies", but undecided about whether or how to refactor |
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.
Suggestion: I'd do column2sep
(you'll have to write it, can pattern after column3sep
, just add sep
before the right column) to add an extra space between the columns, and I'd also add a header:
P.column2Sep " " $ [ (P.hiBlack "Hash", P.hiBlack "Name") ] ++ ...
Or maybe better yet, add a column2Header : Pretty -> Pretty -> [(Pretty, Pretty)] -> Pretty
that encapsulates this pattern of adding a header.
It's also okay as is if you are out of steam, but I had a hard time parsing the current output and think above suggestion might help.
@pchiusano Sounds good. I'll add the column headings, then maybe do {1,2}, and open a ticket to track {3}. |
Overview
This PR adds three commands.
debug.file
I can use
debug.file
to see the hashes of the last typechecked file.Given this .u file:
This will help me make progress in some situations when UCM is being deficient or broken.
dependents
/dependencies
But wait, there's more. I can check the dependencies and dependents of a definition:
I guess this will close #451, which asks for dependencies and/or transitive dependencies.
Implementation notes
We don't have an index for dependents of constructors, but iirc if you ask for that, it will show you dependents of the type that provided the constructor.
Working on this reminded me that
LabeledDependency
exists, and we could probably use it in more places to clean up implementations.LabeledReference
would probably be a better name now.I added the following function in
HandleInput.hs
, which looks similar to many others in there. It might be the best one ever, or it might be a duplicate, we'll have to take a look when we clean up that file.Testing
I caught some bugs through manual testing (e.g. fixed #1399), but it would be good to add some tests in not too long, to prevent regression. I haven't thought too much about what they'd look like, though.
Loose ends