Haskell-language-server: Code action for new GHC module structure

Created on 2 Aug 2020  路  5Comments  路  Source: haskell/haskell-language-server

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.

discussion

Most helpful comment

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.

All 5 comments

@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.

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.

we still think that we should add this code action?

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.

Was this page helpful?
0 / 5 - 0 ratings