From 66eec6f196ff9cdb7eab6c2321526885c69886cf Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 25 Jan 2024 13:43:25 +0000 Subject: [PATCH] Remove `analyseExport` --- src/Weeder.hs | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/Weeder.hs b/src/Weeder.hs index 1a33a48..a5625d5 100644 --- a/src/Weeder.hs +++ b/src/Weeder.hs @@ -57,9 +57,6 @@ import Data.Generics.Labels () -- ghc import GHC.Data.FastString ( unpackFS ) -import GHC.Types.Avail - ( AvailInfo( Avail, AvailTC ) - ) import GHC.Iface.Ext.Types ( BindType( RegularBind ) , ContextInfo( Decl, ValBind, PatternBind, Use, TyDecl, ClassTyDecl, EvidenceVarBind, RecField ) @@ -67,7 +64,7 @@ import GHC.Iface.Ext.Types , EvVarSource ( EvInstBind, cls ) , HieAST( Node, nodeChildren, nodeSpan, sourcedNodeInfo ) , HieASTs( HieASTs ) - , HieFile( HieFile, hie_asts, hie_exports, hie_module, hie_hs_file, hie_types ) + , HieFile( HieFile, hie_asts, hie_module, hie_hs_file, hie_types ) , HieType( HTyVarTy, HAppTy, HTyConApp, HForAllTy, HFunTy, HQualTy, HLitTy, HCastTy, HCoercionTy ) , HieArgs( HieArgs ) , HieTypeFix( Roll ) @@ -273,7 +270,7 @@ analyseHieFile weederConfig hieFile = analyseHieFile' :: ( MonadState Analysis m, MonadReader AnalysisInfo m ) => m () analyseHieFile' = do - HieFile{ hie_asts = HieASTs hieASTs, hie_exports, hie_module, hie_hs_file } <- asks currentHieFile + HieFile{ hie_asts = HieASTs hieASTs, hie_module, hie_hs_file } <- asks currentHieFile #modulePaths %= Map.insert hie_module hie_hs_file g <- asks initialGraph @@ -281,8 +278,6 @@ analyseHieFile' = do for_ hieASTs topLevelAnalysis - for_ hie_exports ( analyseExport hie_module ) - lookupType :: HieFile -> TypeIndex -> HieTypeFix lookupType hf t = recoverFullType t $ hie_types hf @@ -329,23 +324,6 @@ typeToNames (Roll t) = case t of hieArgsTypes = foldMap (typeToNames . snd) . filter fst -analyseExport :: MonadState Analysis m => Module -> AvailInfo -> m () -analyseExport m = \case - Avail name -> - traverse_ addExport $ nameToDeclaration name - - AvailTC name pieces -> do - for_ ( nameToDeclaration name ) addExport - - for_ pieces $ - traverse_ addExport . nameToDeclaration - - where - - addExport :: MonadState Analysis m => Declaration -> m () - addExport d = #exports %= Map.insertWith (<>) m ( Set.singleton d ) - - -- | @addDependency x y@ adds the information that @x@ depends on @y@. addDependency :: MonadState Analysis m => Declaration -> Declaration -> m () addDependency x y =