| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Remove duplication beforing cons'ing a module.
The shortcut ':r' will be used for ':reload' later.
To avoid naming collision.
The :reload command will keep the current list of modules, just try to rebuild them.
| Left errs -> printErrors errs | ||
| Right _ -> put st | ||
| where | ||
| renew :: ImportedModule -> [ImportedModule] -> [ImportedModule] |
There was a problem hiding this comment.
What is this function for?
Sorry, something went wrong.
There was a problem hiding this comment.
It's to prevent import duplication. Previously, when a module was imported twice, it was listed in the imported modules twice. Maybe the name renew is somewhat confusing?
Sorry, something went wrong.
There was a problem hiding this comment.
Previously, when a module was imported twice, it was listed in the imported modules twice.
Is that necessary? Maybe that's what we need to fix?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, that's what I fixed with the patch cd13ee4 included in this PR.
Before:
> import Data.Functor > import Data.Functor > import Data.Functor > import Data.Functor > :show import import Data.Functor import Data.Functor import Data.Functor import Data.Functor >
After:
> import Data.Functor > import Data.Functor > import Data.Functor > import Data.Functor > :show import import Data.Functor >
Sorry, something went wrong.
There was a problem hiding this comment.
I think we want to allow multiple imports with the same name though. Otherwise you can't do something like import something qualified and with selective imports at the same time.
Sorry, something went wrong.
There was a problem hiding this comment.
I understand users can add duplicate imports and PSCi works without any problem. However, according to my understanding, duplicate imports mean nothing, but they are all listed in :show import. I still think we do not need to keep the identical imports in the import list of PSCi.
It's actually not about :r, but import X in PSCi. May I revert it from this PR and open a discussion?
Sorry, something went wrong.
There was a problem hiding this comment.
However, according to my understanding, duplicate imports mean nothing
No, they are useful:
> import Prelude ((+)) > import Prelude as P
This means that I want to use + globally but qualify everything else. If the user typed that, we should preserve both.
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, but my update was removing only the identical ones, where identical means identical at everything including qualification, listed imports, listed hidings.
> import Prelude ((+)) > import Prelude as P > :show import import Prelude ((+)) import Prelude as P > import Prelude > import Prelude > import Prelude ((+)) > import Prelude as P > :show import import Prelude import Prelude ((+)) import Prelude as P
Sorry, something went wrong.
There was a problem hiding this comment.
I think if we were going to do that, we should consolidate any imports under the same namespace. So for example
import Prelude ((+)) import Prelude (bind) import Prelude as P ((*)) import Prelude as P (show)
should give
> :show import import Prelude ((+), (*)) import Prelude as P (bind, show)
Without that, I'm not sure it's worth it to be honest. Also, we could do this once when the user types :show import, rather than doing it on every import.
Sorry, something went wrong.
There was a problem hiding this comment.
Your suggestion looks better. I may upload an issue for the consolidation, and revert the renew from PR. Thanks for your review 👍
Sorry, something went wrong.
|
Looks great! Could you please add a test to tests/TestPsci.hs as well? |
Sorry, something went wrong.
|
Will add a test. |
Sorry, something went wrong.
Currently :clear and :reload are tested.
Even though module names are the same, an import can be allowed if they have different declaration types or qualifications.
|
Updated the renew to check not only the name, but the ImportedModule tuple itself. By this change, multiple imports with different forms work as expected: > import Prelude > import Prelude ((+)) > import Prelude > import Prelude > import Prelude as P > import Prelude > import Prelude ((+)) > import Prelude > :show import import Prelude import Prelude ((+)) import Prelude as P > |
Sorry, something went wrong.
|
There have been some errors about compiling Eq1 and Ord1 but they are fixed by bower cache clean. |
Sorry, something went wrong.
|
Reverted duplication removal for PSCi imports. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Regarding #2713
This PR update the list of commands in PSCi. The current :reset command is renamed to :clear, and a new command :reload is added. :reload is expected to work the same as :reload in GHCi.