Skip to content
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

Code action for new GHC module structure #274

Closed
alanz opened this issue Aug 2, 2020 · 7 comments
Closed

Code action for new GHC module structure #274

alanz opened this issue Aug 2, 2020 · 7 comments
Labels
status: in discussion Not actionable, because discussion is still ongoing or there's no decision yet

Comments

@alanz
Copy link
Collaborator

alanz commented Aug 2, 2020

GHC 9.0 moves modules around, so we have to do things like

#if __GLASGOW_HASKELL__ >= 900
import qualified GHC.Data.Bag          as GHC
import qualified GHC.Driver.Session    as GHC
import qualified GHC.Data.FastString   as GHC
import qualified GHC.Types.Name        as GHC
import qualified GHC.Types.Name.Set    as GHC
import qualified GHC.Utils.Outputable  as GHC
import qualified GHC.Types.Name.Reader as GHC
import qualified GHC.Types.SrcLoc      as GHC
import qualified GHC.Types.Var         as GHC
import qualified GHC.Types.Name.Occurrence as OccName (OccName(..),occNameString,pprNameSpaceBrief)
#else
import qualified Bag            as GHC
import qualified DynFlags       as GHC
import qualified FastString     as GHC
import qualified Name           as GHC
import qualified NameSet        as GHC
import qualified Outputable     as GHC
import qualified RdrName        as GHC
import qualified SrcLoc         as GHC
import qualified Var            as GHC
import qualified OccName(OccName(..),occNameString,pprNameSpaceBrief)
#endif 

Perhaps we could make a code action for this, when running GHC 9.0. Probably just to change the single line, rather than a whole CPP thing.

@wz1000
Copy link
Collaborator

wz1000 commented Aug 2, 2020

@alanz
Copy link
Collaborator Author

alanz commented Aug 2, 2020

@wz1000 thanks, but that is to some extent just kicking the can down the road. I would rather reverse that mapping, and migrate the old names to the new in source.

@wz1000
Copy link
Collaborator

wz1000 commented Aug 2, 2020

I think it would be simpler to use the compat package and reverse the mapping when we drop support for ghc 8.x

Otherwise we will have to maintain both versions.

@Ailrun Ailrun added the status: in discussion Not actionable, because discussion is still ongoing or there's no decision yet label Aug 3, 2020
@jneira
Copy link
Member

jneira commented Nov 9, 2020

we still think that we should add this code action?

@jneira jneira added the status: needs info Not actionable, because there's missing information label Nov 9, 2020
@alanz
Copy link
Collaborator Author

alanz commented Nov 9, 2020

I see it is still moving around on master.

But I do think it may be useful, once a GHC embodying these changes comes out.

@jneira jneira removed the status: needs info Not actionable, because there's missing information label Nov 9, 2020
pepeiborra pushed a commit that referenced this issue Dec 27, 2020
@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Dec 21, 2021

(2 years down the line): GHC still shifts things around. HLS now uses an internal Compat module system, it is ~50% there. & instead of reversing the module API, it has its own minimalistic grouping of changes. Having it centralized internally quite simplified the situation. Now there are thought to eventually form a separate package from the Compat subtree #2454.

@michaelpj
Copy link
Collaborator

I think we've settled on doing this with compat modules, and adding code actions is a bit heavyweight, so I'm going to close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in discussion Not actionable, because discussion is still ongoing or there's no decision yet
Projects
None yet
Development

No branches or pull requests

6 participants