!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~   Safe-Inferred3L Adapted from  to work in MonadIO instances.)Temp directory to create the directory inDirectory name template. See  openTempFile.#Callback that can use the directory Safe-Inferred24MwFold over the declared members - e.g. the method names of a class declaration, the constructors of a data declaration.7Do a fold over the names that are declared in a declaration (not every name that appears, just the ones that the declaration is causing to exist - what's the word for that? Reify!) The function argument takes a Maybe because some declarations don't cause a symbol to become bound - instances, for example.      Safe-Inferred24MSA version of lines that preserves the presence or absence of a terminating newline;Update a SrcLoc to move it from l past the string argument.}Given a beginning and end location, and a string which starts at the beginning location, return a (beforeend,afterend) pair.Build a tree of SrcSpanInfo    Safe-Inferred24M Replace the file at path with the given text, moving the original to the location returned by passing path to backup. If backup is the identity function you're going to have a bad time.  !"#$  !"#$ #$ !"  !"#$ Safe-Inferred((Like diff, but ignores extra files in b.*4Find the paths of all the files below the directory top.+%Convenience function for building the moduVerse, searches for modules in a directory hierarchy. FIXME: This should be in MonadClean and use the value of sourceDirs to remove prefixes from the module paths. And then it should look at the module text to see what the module name really is.%&'()*+%&'()*+%&'()+*%&'()*+ Safe-Inferred0;Decrease the amount of progress reporting during an action.1;Increase the amount of progress reporting during an action. ,-./012345 ,-./012345 ,-./012345,-./012345 Safe-Inferred*234LM9!A regular filepath with a wrapper<1A FilePath that is relative to the SourceDir list?,A FilePath that can be assumed to be unique.CSet the list of directories that will be searched for imported modules. Similar to the Hs-Source-Dirs field in the cabal file.EKModify the list of directories that will be searched for imported modules.GSearch the path directory list, preferring an already existing file, but if there is none construct one using the first element of the directory list.HhDerive a relative FilePath from a module name based on the file type inferred by the extension. Thus, !modulePathBase "hs" (ModuleName System.Control.Monad) returns "SystemControl Monad.hs", while &modulePathBase "imports" (ModuleName System.Control.Monad) returns "System.Control.Monad.imports".6789:;<=>?@ABCDEFGHI6789:;<=>?@ABCDEFGHIBCDEF<=>?@A9:;I678GH6789:;<=>?@ABCDEFGHI None *234LMTop level directories to search for source files and imports. These directories would be the value used in the hs-source-dirs parameter of a cabal file, and passed to ghc via the -i option.SFrom hsx2hs, but removing Arrows because it makes test case fold3c and others fail.]Modify the list of extensions passed to GHC when dumping the minimal imports. Note that GHC will also use the extensions in the module's LANGUAGE pragma, so this can usually be left alone.`.Force a possibly cached module to be reloaded.Run ) with the extensions stored in the state."JKLMNOPQRSTUVWXYZ[\]^_`aJKLMNOPQRSTUVWXYZ[\]^_`aNOPQRSTMUJKLVWXYZ[\]^_`aJKLMNOPQRSTUVWXYZ[\]^_`a None 234LMeAn instance of MonadClean.fpThis contains the information required to run the state monad for import cleaning and module spliting/mergeing.h3Location of the temporary directory for ghc output.i[None of the operations that modify the modules will actually be performed if this is ture.j6Increase or decrease the amount of progress reporting.kExtra flags to pass to GHC.lbThe set of modules that splitModules and catModules will check for imports of symbols that moved.mBPaths added to this list are removed as the state monad finishes.nIf true, remove any import that became empty due to the clean. THe import might still be required because of the instances it contains, but usually it is not. Note that this option does not affect imports that started empty and end empty.oDeciding whether a module needs to be imported can be difficult when instances are involved, this is a cheat to force keys of the map to import the corresponding elements.pbFor testing, do not run cleanImports on the results of the splitModule and catModules operations.rhCreate the environment required to do import cleaning and module splitting/merging. This environment, StateT Params m a, is an instance of b.tIf this flag is set, imports that become empty are removed. Sometimes this will lead to errors, specifically when an instance in the removed import that was required is no longer be available. (Note that this reflects a limitation of the -ddump-minimal-importsm option of GHC.) If this happens this flag should be set. Note that an import that is already empty when  cleanImportst runs will never be removed, on the assumption that it was placed there only to import instances. Default is True.u:Modify the list of extra flags passed to GHC. Default is [].vControls whether file updates will actually be performed. Default is False. (I recommend running in a directory controlled by a version control system so you don't have to worry about this.)wIf TestMode is turned on no import cleaning will occur after a split or cat. Default is False. Note that the modules produced with this option will often fail to compile to to circular imports. (Does this seem counterintuitive to anyone else?)xWhen we write module mF, insert an extra line that imports the instances (only) from module i.bcdefghijklmnopqrstuvwxbcdefghijklmnopqrstuvwxfghijklmnopebcdqrstuvwxbcdef ghijklmnopqrstuvwx None234M The spans returned by haskell-src-exts may put comments and whitespace in the suffix string of a declaration, we want them in the prefix string of the following declaration where possible.yGiven the result of parseModuleWithComments and the original module text, this does a fold over the parsed module contents, calling the seven argument functions in order. Each function is passed the AST value, the text of the space and comments leading up to the element, and the text for the element. Note that not everything passed to the "pre" argument of the functions will be comments and space - for example, the "module" keyword will be passed in the pre argument to the ModuleName function.zDo just the header portion of y.{Do just the exports portion of y.|Do just the imports portion of y.}$Do just the declarations portion of y.~KThis can be passed to foldModule to include the original text in the result Similar to ~3, but used for the two argument separator functionsKThis can be passed to foldModule to omit the original text from the result. Similar to 3, but used for the two argument separator functions#y +Receives the space before the first pragma.Called once for each pragma. In this and the similar arguments below, the three string arguments contain the comments and space preceding the construct, the text of the construct and the space following it.Called with the module name.@Called with the warning text between module name and export list&Called with the export list open paren!Called with each export specifier;Called with the export list close paren and "where" keyword"Called with each import declarator&Called with each top level declaration 3Called with comments following the last declaration  Parsed module Fold initialization value Resultz{|}~ yz{|}~ yz{|}~yz{|}~ None234LM'Convert a compare function into an (==)Combine sortBy and groupBy4Perform an action with the working directory set to path. It is tempting to put import cleaning into these operations, but that needs to be done after all of these operations are completed so that all the compiles required for import cleaning succeed. On the other hand, we might be able to maintain the moduVerse here.hUpdate an export spec. The only thing we might need to change is re-exports, of the form "module Foo".  None*ELM @Collect the declared types of a standalone deriving declaration.3Clean up the imports of a source file. This means:/All import lines get an explict list of symbols%Imports of unused symbols are removedMImports of modules whose symbol list becomse empty are removed, unless the n flag is set to FalseA. However, imports that started out with an empty import list () are retainedRepeated imports are merged'Imports are alphabetized by module name0Imported symbols are alphabetized by symbol name:Imported constructors and field accessors are alphabetizedDo import cleaning in response to the values returned by the split and merge operations. Module import lists are cleaned if the module is modified or created.LRun ghc with -ddump-minimal-imports and capture the resulting .imports file.#Parse the import list generated by GHC, parse the original source file, and if all goes well insert the new imports into the old source file. We also need to modify the imports of any names that are types that appear in standalone instance derivations so their members are imported too.sIf all the parsing went well and the new imports differ from the old, update the source file with the new imports.yCompare the old and new import sets and if they differ clip out the imports from the sourceText and insert the new ones.1Final touch-ups - sort and merge similar imports.Compare the two import declarations ignoring the things that are actually being imported. Equality here indicates that the two imports could be merged.BBe careful not to try to compare objects with embeded SrcSpanInfo.;If true, imports that turn into empty lists will be removedNoneLMMerge the declarations from several modules into a single new one, updating the imports of the modules in the moduVerse to reflect the change. It *is* permissable to use one of the input modules as the output module. Note that circular imports can be created by this operation.kGrab the declarations out of the old modules, fix any qualified symbol references, prettyprint and return.Bug: If we cat two modules A and B, and A imported a symbol from B and referenced that symbol with a qualifier from an "as" import, the as qualifier needs to be changed to a full qualifier.In terms of what is going on right here, if m imports any of the modules in oldmap with an "as" qualifier, identifiers using the module name in the "as" qualifier must use new instead.Change any ModuleName in old to new.NoneEM ]Split the declarations of the module in the input file into new modules as specified by the  symToModuleT function, which maps symbol name's to module names. It is permissable for the output function to map one or more symbols to the original module. The modules will be written into files whose names are constructed from the module name in the usual way, but with a prefix taken from the first element of the list of directories in the  SourceDirs list. This list is just ["."] by default.Split each of a module's declarations into a new module. Update the imports of all the modules in the moduVerse to reflect the split. For example, if you have a module like Smodule Start (a, b, (.+.)) where import a = 1 + a b = 2 c = 3 c' = 4 (.+.) = b + c After running splitModuleDecls "Start.hs" the Start module will be gone. The a and b' symbols will be in new modules named Start.A and Start.B&. Because they were not exported by Start, the c and c'- symbols will both be in a new module named Start.Internal.C . And the .+.# symbol will be in a module named Start.OtherSymbols.. Note that this module needs to import new Start.A and Start.Internal.C modules.[If we had imported and then re-exported a symbol in Start it would go into a module named Start.ReExported,. Any instance declarations would go into Start.Instances.LDo splitModuleBy with the default symbol to module mapping (was splitModule)Combine the suffix of each export with the prefix of the following export to make a list of all the separators. Discards the first prefix and the last suffix, if all the remaining separators are equal return it, otherwise return the default argument.[Return a list of the names declared in this module, Nothing denotes one or more instances.NReturn a list of the names expored by this module, Nothing denotes instances.!Classify the symbols in a module.4This can be used to build the function parameter of :, it determines which module should a symbol be moved to. 8Build an import of the symbols created by a declaration.    CMap each symbol name to the module it will be moved to. The name Nothing$ is used for instance declarations.%The file containing the input module.%The file containing the input module.NFunction mapping symbol names of the input module to destination module name.The parsed input module.Parent module name      None*+01CEHXZ]bertuvwxberXZvut]wECx10H+* !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKKLMMNOOPQRSTUVWX Y Z [ \ ] ] ^ _ ` a b c d e f g h i j k l m n o p q r s t t u v w x y z { | } ~            \   _                 module-management-0.20.4Language.Haskell.Modules"Language.Haskell.Modules.Util.Temp%Language.Haskell.Modules.Util.Symbols$Language.Haskell.Modules.Util.SrcLoc#Language.Haskell.Modules.Util.DryIO"Language.Haskell.Modules.Util.Test!Language.Haskell.Modules.Util.QIO#Language.Haskell.Modules.SourceDirs"Language.Haskell.Modules.ModuVerseLanguage.Haskell.Modules.ParamsLanguage.Haskell.Modules.FoldLanguage.Haskell.Modules.Common Language.Haskell.Modules.ImportsLanguage.Haskell.Modules.MergeLanguage.Haskell.Modules.SplitSystem.IO.TempwithTempDirectoryhaskell-src-exts-1.16.0.1Language.Haskell.Exts.Syntax ModuleNameIdentSymbolName FoldMembers foldMembers FoldDeclared foldDeclaredsymbolsmembersexportsimports HasSpanInfospanInfosrcSpansrcLocendLoc textEndLocincreaseSrcLoctextSpan srcPairTextmakeTree MonadDryRundryputDry tildeBackupnoBackup readFileMayberemoveFileIfPresentreplaceFileIfDifferent replaceFilecreateDirectoryIfMissing writeFiledryIOdryIO' repoModules logicModulesdiffdiff'rsync findHsFiles findHsModulesMonadVerbosity getVerbosity putVerbositymodifyVerbosityquietlynoisilyqIOqPutStr qPutStrLn qLnPutStrPath findFileMaybe pathKeyMaybeAPathunAPathRelPath unRelPathPathKey unPathKey SourceDirsputDirsgetDirs modifyDirswithDirs modulePathmodulePathBasepathKey ModuVerse getModuVersemodifyModuVerseModuVerseState ModuleInfomodule_text_ comments_key_ moduleName moduVerseInitgetNamesgetInfo putModule putModuleAnew findModuledelName getExtensionsmodifyExtensions parseModuleparseModuleMaybe loadModule unloadModule MonadClean getParams putParamsCleanTParams scratchDirdryRun verbosityhsFlags moduVersejunkremoveEmptyImports extraImportstestMode modifyParams runCleanT markForDeletemodifyRemoveEmptyImports modifyHsFlags modifyDryRunmodifyTestMode extraImport foldModule foldHeader foldExports foldImports foldDeclsechoecho2ignoreignore2 ModuleResult JustCreated ToBeCreated JustModified ToBeModified JustRemoved ToBeRemoved UnchangedgroupBy'withCurrentDirectory reportResultdoResult fixExport cleanImports cleanResults mergeModules splitModulesplitModuleDecls splitModuleBydefaultSymbolToModuleignoringIOErrorsjusts$fFoldDeclaredGadtDecl$fFoldDeclaredFieldDecl$fFoldDeclaredConDecl$fFoldDeclaredQualConDecl$fFoldMembersDecl$fFoldDeclaredExportSpec$fFoldDeclaredImportSpec$fFoldDeclaredName$fFoldDeclaredRPat$fFoldDeclaredPatField$fFoldDeclaredPat$fFoldDeclaredQName$fFoldDeclaredMatch$fFoldDeclaredInstRule$fFoldDeclaredInstHead$fFoldDeclaredClassDecl$fFoldDeclaredDeclHead$fFoldDeclaredDecllines'Decl ImportDecl ExportSpecExportSpecList WarningText ModulePragma ModuleHeadcovers coveredBy$fHasSpanInfoSrcSpanInfo$fHasSpanInfoDecl$fHasSpanInfoImportDecl$fHasSpanInfoExportSpec$fHasSpanInfoExportSpecList$fHasSpanInfoWarningText$fHasSpanInfoModulePragma$fHasSpanInfoModuleName$fHasSpanInfoModuleHead$fHasSpanInfoTree$fHasSpanInfoSrcSpanfindFile $fPathAPath $fPathPathKey $fPathRelPath sourceDirs_ hseExtensionsparseFileWithCommentsLanguage.Haskell.Exts.Annotated moduleNames_ moduleInfo_ extensions_nameToExtensionputName $fSourceDirsm$fMonadDryRunm$fMonadVerbositym$fMonadCleanStateT $fModuVersem adjustSpansStloc_comms_sps_SpansspansfixSpan setSpanEnd$fSpansWarningText$fSpansModuleName $fSpansDecl$fSpansImportDecl$fSpansModulePragma$fSpansExportSpec$fSpansExportSpecList$fSpansModuleHead $fSpansModuletoEqDerivDeclTypes dumpImports checkImports updateSourcereplaceImports fixNewImportsimportMergable unModuleNamederivDeclTypeswithDotstandaloneDerivingTypes compareSpecs equalSpecs mergeSpecs nameString$fDerivDeclTypesType$fDerivDeclTypesInstHead$fDerivDeclTypesInstRule$fDerivDeclTypesDecl moduleDecls fixReferencesdoModule moduleImports exportSepdeclaredexported declClass toImportDecl DeclClassUnknownInstance ReExportedInternalExportedinstanceImports isReExportedsetAny$fDefaultImportDecl