ϻY      !"#$%&'()*+,-./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-Inferred Adapted from  to work in MonadIO instances. *Temp directory to create the directory in Directory name template. See  openTempFile. $Callback that can use the directory  Safe-InferredBFold over the declared members - e.g. the method names of a class 6 declaration, the constructors of a data declaration. ADo 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!)       Safe-Inferred?A 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. AGiven a beginning and end location, and a string which starts at = the beginning location, return a (beforeend,afterend) pair. Build a tree of SrcSpanInfo   NoneNone Safe-Inferred BReplace the file at path with the given text, moving the original C 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 D MonadClean and use the value of sourceDirs to remove prefixes from B the module paths. And then it should look at the module text to % see what the module name really is. %&'()*+%&'()*+%&'()+*%&'()*+ Safe-Inferred ,-./012345 ,-./012345 ,-./012345,-./012345 Safe-Inferred9"A regular filepath with a wrapper <2A FilePath that is relative to the SourceDir list ?-A FilePath that can be assumed to be unique. GISearch the path directory list, preferring an already existing file, but O if there is none construct one using the first element of the directory list. H%Construct the base of a module path. 6789:;<=>?@ABCDEFGHI6789:;<=>?@ABCDEFGHIBCDEF<=>?@A9:;I678GH6789:;<=>?@ABCDEFGHI None5Top 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. TFrom hsx2hs, but removing Arrows because it makes test case fold3c and others fail. `/Force a possibly cached module to be reloaded. Run * with the extensions stored in the state. !JKLMNOPQRSTUVWXYZ[\]^_`aJKLMNOPQRSTUVWXYZ[\]^_`aNOPQRSTMUJKLVWXYZ[\]^_`aJKLMNOPQRSTUVWXYZ[\]^_`a NoneeAn instance of MonadClean. fBThis contains the information required to run the state monad for $ import cleaning and module spliting/ mergeing. h4Location of the temporary directory for ghc output. i=None of the operations that modify the modules will actually  be performed if this is ture. j7Increase or decrease the amount of progress reporting. kExtra flags to pass to GHC. l9The set of modules that splitModules and catModules will * check for imports of symbols that moved. m8Paths added to this list are removed as the state monad  finishes. n8If 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. o6Deciding whether a module needs to be imported can be A difficult when instances are involved, this is a cheat to force 7 keys of the map to import the corresponding elements. p;For testing, do not run cleanImports on the results of the ( splitModule and catModules operations. rACreate the environment required to do import cleaning and module  splitting/5merging. This environment, StateT Params m a, is an  instance of MonadClean. t<If this flag is set, imports that become empty are removed. C Sometimes this will lead to errors, specifically when an instance D in the removed import that was required is no longer be available. . (Note that this reflects a limitation of the  -ddump-minimal-imports, option of GHC.) If this happens this flag @ should be set. Note that an import that is already empty when   cleanImports4 runs will never be removed, on the assumption that A it was placed there only to import instances. Default is True. u:Modify the list of extra flags passed to GHC. Default is []. v:Controls whether file updates will actually be performed. C Default is False. (I recommend running in a directory controlled ' by a version control system so you don't have to worry about this.) w?If TestMode is turned on no import cleaning will occur after a " split or cat. Default is False. xWhen we write module m(, insert an extra line that imports the  instances (only) from module i. bcdefghijklmnopqrstuvwxbcdefghijklmnopqrstuvwxfghijklmnopebcdqrstuvwxbcdef ghijklmnopqrstuvwx None <The spans returned by haskell-src-exts may put comments and C whitespace in the suffix string of a declaration, we want them in @ the prefix string of the following declaration where possible. y=Given the result of parseModuleWithComments and the original @ module text, this does a fold over the parsed module contents, B calling the seven argument functions in order. Each function is E 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 8 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. ~LThis can be passed to foldModule to include the original text in the result  Similar to ~4, but used for the two argument separator functions LThis can be passed to foldModule to omit the original text from the result.  Similar to 4, but used for the two argument separator functions #y ,Receives the space before the first pragma. jCalled once for each pragma. In this and the similar arguments below, the three string arguments contain g the comments and space preceding the construct, the text of the construct and the space following it. Called with the module name. ACalled 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 4Called with comments following the last declaration Parsed module Fold initialization value Result z{|}~ yz{|}~ yz{|}~yz{|}~ None(Convert a compare function into an (==) Combine sortBy and groupBy AIt is tempting to put import cleaning into these operations, but C that needs to be done after all of these operations are completed D so that all the compiles required for import cleaning succeed. On B the other hand, we might be able to maintain the moduVerse here. BUpdate an export spec. The only thing we might need to change is  re-exports, of the form  module Foo.   None'Clean up the imports of a source file. MRun ghc with -ddump-minimal-imports and capture the resulting .imports file. BParse 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 B that are types that appear in standalone instance derivations so ! their members are imported too. AIf all the parsing went well and the new imports differ from the 3 old, update the source file with the new imports. @Compare the old and new import sets and if they differ clip out : the imports from the sourceText and insert the new ones. 2Final touch-ups - sort and merge similar imports. ACompare the two import declarations ignoring the things that are @ actually being imported. Equality here indicates that the two  imports could be merged. CBe careful not to try to compare objects with embeded SrcSpanInfo. <If true, imports that turn into empty lists will be removed None>Merge the declarations from several modules into a single new > one, updating the imports of the modules in the moduVerse to B reflect the change. It *is* permissable to use one of the input B modules as the output module. Note that circular imports can be  created by this operation. 6Grab the declarations out of the old modules, fix any 6 qualified symbol references, prettyprint and return. CBug: If we cat two modules A and B, and A imported a symbol from B 5 and referenced that symbol with a qualifier from an as import, the 7 as qualifier needs to be changed to a full qualifier. AIn 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. NoneSplit each of a module'*s declarations into a new module. Update G the imports of all the modules in the moduVerse to reflect the split. ( For example, if you have a module like   " module 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. CIf 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. MDo splitModuleBy with the default symbol to module mapping (was splitModule)  CCombine the suffix of each export with the prefix of the following B export to make a list of all the separators. Discards the first A prefix and the last suffix, if all the remaining separators are 9 equal return it, otherwise return the default argument.  <Return a list of the names declared in this module, Nothing  denotes one or more instances.  ;Return a list of the names expored by this module, Nothing  denotes instances.  "Classify the symbols in a module. @This can be used to build function parameter of splitModule, it 6 determines which module should a symbol be moved to.  9Build an import of the symbols created by a declaration. /Map declaration to new module name. The name Nothing $ is used for instance declarations.     Parent module name       None  !"#$%&  !"#$%&  !"#$%&None*+01CEHXZ]bertuvwxberXZvut]wECx10H+*None'JCan we handle a Main module in a file named something other than Main.hs? (Preserve imports with a hiding clause );Preserve imports used by a standalone deriving declaration *Comment at EOF +,-'()*.+,-'()*.+,-'()*.None/012345/012345/012345None 6789:;<=>?@A 6789:;<=>?@A 6789:;<=>?@AB !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQQRSSTUUVWXYZ[\]^ _ ` a b c c d e f g h i j k l m n o p q r s t u v w x y z z { | } ~            b   e                      !"!"!#$%&'()*+,-.module-management-0.15Language.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.TempwithTempDirectory Tests.SrcLoc Tests.Symbols Tests.Fold Tests.Imports Tests.Merge Tests.Splithaskell-src-exts-1.13.5Language.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 splitModulesplitModuleDeclsdefaultSymbolToModuleignoringIOErrorsjusts$fFoldDeclaredGadtDecl$fFoldDeclaredFieldDecl$fFoldDeclaredConDecl$fFoldDeclaredQualConDecl$fFoldMembersDecl$fFoldDeclaredExportSpec$fFoldDeclaredImportSpec$fFoldDeclaredName$fFoldDeclaredRPat$fFoldDeclaredPatField$fFoldDeclaredPat$fFoldDeclaredQName$fFoldDeclaredMatch$fFoldDeclaredInstHead$fFoldDeclaredClassDecl$fFoldDeclaredDeclHead$fFoldDeclaredDecllines'Decl ImportDecl ExportSpecExportSpecList WarningText ModulePragma ModuleHeadcovers coveredBy$fHasSpanInfoSrcSpanInfo$fHasSpanInfoDecl$fHasSpanInfoImportDecl$fHasSpanInfoExportSpec$fHasSpanInfoExportSpecList$fHasSpanInfoWarningText$fHasSpanInfoModulePragma$fHasSpanInfoModuleName$fHasSpanInfoModuleHead$fHasSpanInfoTree$fHasSpanInfoSrcSpanteststest1test2test3test4test5deffindFile $fPathAPath $fPathPathKey $fPathRelPath sourceDirs_ hseExtensionsparseFileWithCommentsLanguage.Haskell.Exts.Annotated moduleNames_ moduleInfo_ extensions_putName $fSourceDirsm$fMonadDryRunm$fMonadVerbositym$fMonadCleanStateT $fModuVersem adjustSpansStloc_comms_sps_SpansspansfixSpan setSpanEnd$fSpansWarningText$fSpansModuleName $fSpansDecl$fSpansImportDecl$fSpansModulePragma$fSpansExportSpec$fSpansExportSpecList$fSpansModuleHead $fSpansModuletoEq dumpImports checkImports updateSourcereplaceImports fixNewImportsimportMergable unModuleNamewithDotstandaloneDerivingTypes compareSpecs equalSpecs mergeSpecs nameString moduleDecls fixReferencesdoModule moduleImports exportSepdeclaredexported declClass toImportDecl DeclClassUnknownInstance ReExportedInternalExported splitModuleByinstanceImports isReExportedsetAny$fDefaultImportDecltest1bintfold3bfold3ctest5btest6test7slowsplit1split2asplit2bsplit4split4bsplit4csplit5split6split7split7b