uz      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy(c) JP Moresmau 2011BSD3jpmoresmau@gmail.combetaportableNone+FEvaluation of result using String since we get them from GHC API this can be fully evaluated via deepseq to make sure any side effect are evaluatedUsage structure ?information about files to load (single file or multiple files)@import clean operation: the span of text to change, the new texta cabal packagename of packageversion is the package exposed or hidden2components in the cabal file that use this packageeall modules. We keep all modules so that we can try to open non exposed but imported modules directlycomponent in cabal file  test suite!benchmark name" test suite#test suite name$ executable%executable name&library'is the library buildable("Verbosity settings -=information about the thing at a given point in the source 5'build flags for a specific file 7 flags for GHC8flags for preprocessor9module name if known:%component used to get flags, if known;complete result for outline =outline contents>exports?imports@&definition of an import statement B module nameC package nameDlocation in source fileEis the import qualifiedF2is the import element list for hiding or exposing G alias nameHspecific import elementsI"definition of an import element KnameLtypeMlocation in source fileN"children (constructor names, etc.)Odefinition of exportQnameRtypeSlocation in source fileT"children (constructor names, etc.)U#Type of import/export directive Vreexport moduleWspecific import/export listXimport/export everythingYAbsZVar[ Lexer token] type of token^location_element of the outline resultanameb"types: can have several to combinecspan in sourcedchildren (constructors...)etype signature if anyfcomment if any,gcomment start line if any,hdefinition of a namejnamek"types: can have several to combineltype signature if anymFSpan inside a file, the file is known and doesn't need to be repeated ostart locationp end locationqJLocation inside a file, the file is known and doesn't need to be repeated slinetcolumnu(type of elements for the outline {result for building one file: success + names data Build1Result=Build1Result Bool [NameDef] deriving (Show,Read,Eq)sinstance ToJSON Build1Result where toJSON (Build1Result b ns)= object ["r" .= b, "ns" .= map toJSON ns] Linstance FromJSON Build1Result where parseJSON (Object v) =Build1Result  $# v .: "r"  *? v .: "ns" parseJSON _= mzero "which cabal file to use operations0use temporary file that was saved in temp folderuse proper file result: success + files impacteddsimple type encapsulating the fact the operations return along with notes generated on files a note on a source filestatus of the notemessagewhere the note is7location of a note/error (lines and columns start at 1) source file linecolumnend lineend line!status of notes: error or warningthe state we keepname of temporary folderpath to the cabal executablepath of the project cabal fileverbosity of loggingflags to pass cabal"extra arguments to cabal configurelog call to cabal State typeEread an object from a String, with a given error message if it fails 7build an empty span in a given file at a given locationis a note an error? do spans overlap?does span overlap location?construct a file spanDconstructs an OutlineDef with no children and no type signature Aconstructs an OutlineDef with children and no type signature -get the full path for the temporary directoryVget the full path for the temporary dist directory (where cabal will write its output)|get full path in temporary folder for source file (i.e. where we're going to write the temporary contents of an edited file),get the full, canonicalized path of a sourceget the full path of a source6copy a file from the normal folders to the temp folder4is the source file more recent than the target file?/replace relative file path by module name get the cabal component nameget files to load _http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html _http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html:delete files in temp folder but not in real folder anymoredelete all temporary filesdelete generated files Edebug method: fromJust with a message to display when we get Nothing >remove a base directory from a string representing a full path"nub for Ord objects: use a set 7debug method to vaguely format JSON result to dump themBread a string from a file, forcing the read and closing the handlewrite string to file)perform operation on a binary opened file7splits a string at the first occurence of prefix   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ start line start columnend line end columnname"types: can have several to combinespan in sourcename"types: can have several to combinespan in sourcechildren (constructors...)relative path of source filerelative path of source filerelative path of source filecopy even if temp file is newerrelative path of source file<return Just the file if copied, Nothing if no copy was done   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~u~}|{zyxwvqrstmnophijkl_`abcdefg[\]^UZYXWVOPQRSTIJKLMN@ABCDEFGH;<=>?56789:-./01234(,+*)&$" '%'#'!' f  &$" '%'#'!'(,+*)-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUZYXWV[\]^_`abcdefghijklmnopqrstu ~}|{zyxwv(c) JP Moresmau 2011BSD3jpmoresmau@gmail.combetaportableNoneFM6-the cabal build info for a specific component the target'the folder to build that component intois the component the libraryOthe module name and corresponding source file for each contained Haskell modulethe component handle$get the version of the cabal library$get all files to copy to temp folderget cabal verbose levelrun cabal buildrun cabal build"the file where we save the targetsrun cabal configure#get the full path to the cabal file get package name from cabal file1get Cabal build info, running configure if needed&run a action with the cabal build info6parse cabal error messages and transform them in notreget the setup exe file name#get cabal executable from cabal-dev1drop all potential prefixes from the given string,stop prefix if the given string starts by it.add a note with a potential additional messageparse a Cabal error lineparse messages from buildget a valid path <read an integer and return a default value if not readable 7read a list and return the empty list if not readable add a message to the note'get the path of a file getting compiled (canonicalize the paths in the build info @apply a function on the build info modules and paths, in a monad 4apply a function on the build info modules and paths tget the build info for a given source file if a source file is in several component, get the first one  set the GHC options on targets&get GHC options for a file get CPP options for a fileget the cabal extensions*get the source directory from a build infoJget all components, referencing all the files found in the source folders get build dir for a target Vget all components, referencing only the files explicitely indicated in the cabal file(parse a string into a module name (convert a ModuleName to a String $get all components in the Cabal file*get all the dependencies in the cabal file\get all dependencies from the package description and the list of installed packages 7get all components from the package description ,get dependencies for all stanzas 4convert a dynamic cabla target into a CabalComponent0transform a library target into a CabalComponent4transform an executable target into a CabalComponent3transform a test suite target into a CabalComponent 2transform a benchmark target into a CabalComponent7=do we want output (True) or just compilation without linking?%use original cabal or temp cabal filecan we rerun configure again=do we want output (True) or just compilation without linking?%use original cabal or temp cabal file%use original cabal or temp cabal file7return the build info on success, or Nothing on failure%use original cabal or temp cabal file%use original cabal or temp cabal file%use original cabal or temp cabal file$action to run if we get a build info?the result of the action, or Nothing if we could get Cabal info cabal filepath to cabal executable error outputpath to cabal executablepath to cabal executable cabal filepath to cabal executableline first error? cabal filepath to cabal executablethe dist directorythe build output the cabal file  the dist dir original note message linesthe message linethe path if we could parse it  the function to applythe original build info the result the function to applythe original build info the result the source file7the cabal component to use, or Nothing if not specified dist directory$path to GHC if explicitely specifiedtargets to set options ontothe cabal info+the module name and the options to pass GHCthe cabal infothe list of CPP optionsthe cabal info$the module name and cabal extensionsthe build info%the source paths, guaranteed non nullthe build info(the path to the cabal-dev sandbox if anythe result is an array of tuples: the path to the package database, the list of packages in that db that the Cabal file referencesthe cabal description4the installed packages, by package database location5the referenced packages, by package database locationthe package descriptionthe package description 7      7      1      (c) JP Moresmau 2012BSD3jpmoresmau@gmail.combetaportableNoneFHM#zsimple type for search function{>get the file storing the information for the given source file|>get the file storing the information for the given source file}remove the storage file~store the build flagsgenerate the JSON from the typechecked module this incorporates info from the renamed source with types annotations from the typechecked sourcestore the GHC generated AST read the GHC AST as a JSON value.read the build flags and notes as a JSON value>utility function to store the given value under the given key 6read the top JSON value containing all the informationwrite the usage info fileread the usage info fileqconvert a Data into a JSON value, with specific treatment for interesting GHC AST objects, and avoiding the holes:get type of an expression, inspired by the code in ghc-modshow SDoc wrappershow SDoc for user wrappershow SDoc for dump wrapper!convert a SrcSpan to a JSON Value convert a SrcLoc to a JSON Value'get all types contained by another type-find in JSON AST and return the string resultfind a named value in JSON datafind in JSON ASTfind in JSON AST*sort Value by position, descending ?overlap function: find whatever is at the given line and columnCcontains function: find whatever is contained inside the given span8isGHCType function: find whatever has the proper GHCType'extract usages from a global JSON Value%Extract name values from a JSON Value,extract source information from a JSON Value!extract the source span from JSON%extract the source location from JSON"resolve the ident in an expression#z{the source file|the source file}the source file~the source filebuild flags and notesthe source file the GHC ASTthe source filethe source filethe source file*the key under which the value will be put  the valuethe source filethe source file the valuethe source fileshould the output be qualified?!should the output be fully typed?result of search the evaluation function #the root object containing the AST the evaluation function #the root object containing the AST linecolumn start line start columnend line end column#the root object containing the AST #z{|}~#z{|}~(c) JP Moresmau 2011BSD3jpmoresmau@gmail.combetaportableNone *+26=EFM;!&map from original text to needed names"6mapping to import declaration to actually needed names##module, function/type, constructors$map of imports%map of module aliases &preprocessor behavior data+Da function taking the file name and typechecked module as parameters,get the GHC typechecked AST-/perform an action on the GHC Typechecked module.%perform an action on the GHC JSON AST/4the main method loading the source contents into GHC0init GHC session14run a GHC action and get results with notes 2do we have -Werror 3Convert  to '[BWNote]'.lThis will mix warnings and errors, but you can split them back up by filtering the '[BWNote]' based on the  bw_status.4get all names in scope5,get all names in scope, packaged in NameDefs6[get all names in scope, packaged in NameDefs, and keep running a loop listening to commands7$evaluate expression in the GHC monad80convert a Name int a NameDef 9qget the "thing" at a particular point (line/column) in the source this is using the saved JSON info if available:qget the "thing" at a particular point (line/column) in the source this is using the saved JSON info if available;evaluate an expression<?convert a GHC SrcSpan to a Span, ignoring the actual file info=(convert a GHC SrcSpan to a BWLocation >Lconvert a column info from GHC to our system (1 based) ?<convert a column info from our system (1 based) to GHC @KGet a stream of tokens generated by the GHC lexer from the current documentAKGet a stream of tokens generated by the GHC lexer from the current documentB*like lexTokenStream, but keep Haddock flagCget lexer initial locationDget lexer flagsEvFilter tokens whose span appears legitimate (start line is less than end line, start column is less than end column.)FDConvert a GHC token to an interactive token (abbreviated token type)G^Generate the interactive token list used by EclipseFP for syntax highlighting, in the IO monadHlGenerate the interactive token list used by EclipseFP for syntax highlighting, when already in a GHC sessionI%Extract occurrences based on lexing J%Extract occurrences based on lexing KNParse the current document, generating a TokenDef list, filtered by a functionLNParse the current document, generating a TokenDef list, filtered by a functionMKPreprocess some source, returning the literate and Haskell source as tuple.N,convert a GHC error message to our note typeO.convert a GHC warning message to our note typePconvert a GHC message to our note type Note that we do *not* include the extra info, since that information is only useful in the case where we do not show the error location directly in the source.Q-remove the initial status text from a messageRmake unqualified tokenS>make qualified token: join the qualifier and the name by a dotTmake a text name from a tokenUget token type from TokenVa dot as a FastStringWgenerate a token valueX.extract start line and column from SrcSpan Y,extract end line and column from SrcSpan Zget usages from GHC imports[get usages from GHC IE \get usage from GHC exports ]"generate a usage for a name ^$build an import map from all imports_clean imports @!"#$%&'()*+,the source filethe base directorythe module name the GHC options - the actionthe source filethe base directorythe module namethe GHC options. the actionthe source filethe base directorythe module name the GHC options/)the final action to perform on the result-transform given file path to find bwinfo paththe base directory what to loadthe GHC options 0the GHC options1)the final action to perform on the result-transform given file path to find bwinfo paththe base directory what to loadadd the target?23base directory GHC messages4 source pathbase directory module name build options5 source pathbase directory module name build options6 source pathbase directory module name build options789linecolumn -> Bool ^ do we want the result qualified by the module -> Bool ^ do we want the full type or just the haddock typesource file pathbase directory module name build flags: start line start columnend line end columnsource file pathbase directory module name build flags;the expressionsource file pathbase directory module name build flags<=Base directory>?@The file path to the documentThe document's contents The optionsAThe file path to the documentThe document's contentsBCDEFGHI;Project root or base directory for absolute path conversionContents to be parsedToken value to find8Literate source flag (True = literate, False = ordinary)OptionsJ;Project root or base directory for absolute path conversionContents to be parsedToken value to find8Literate source flag (True = literate, False = ordinary)KThe project's root directory+The current document contents, to be parsedLiterate Haskell flag The options/Transform function from GHC tokens to TokenDefsThe TokenDef filter functionLThe project's root directory+The current document contents, to be parsedLiterate Haskell flag/Transform function from GHC tokens to TokenDefsThe TokenDef filter functionMthe source contentsis the source literate Haskell:the preprocessor tokens and the final valid Haskell sourceNOPQRthe nameS the qualifierthe nameTUVWXYZ[\]^_ source pathbase directory module name build optionsformat?`?!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_@+,-./0123456789:;<=>?@ABCDEFGHIJKLM&*)('NOPQRSTUVW`XY%Z[\]$^#"!_<!"#$%&*)('+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`(c) JP Moresmau 2011BSD3jpmoresmau@gmail.combetaportableNone2F  get the AST#get the ouline from the AST #get the ouline from the AST build the comment map"get the import/export declarations extract name extract class name extract qualified name extract module name,convert a HSE span into a buildwrapper span "all known extensions, as string  input textoptionsthe commented ASTthe commented ASTfthe map: key is line, value is start column, start line, comment is for after/before, and comment text the commentthe AST   (c) JP Moresmau 2011BSD3jpmoresmau@gmail.combetaportableNoneFMa7copy all files from the project to the temporary folderbsynchronize one file onlyc write contents to temporary filedrun cabal configureerun cabal buildf generate usage information filesgbuild one source file in GHChbuild one source file in GHCipreprocess a filej%get the build flags for a source filek2get haskell-src-exts commented AST for source filel'get GHC typechecked AST for source filem perform an action on the GHC ASTnJperform an action on the GHC AST, returning notes alonside with the resultoget outline for source filep&get lexer token types for source file q*get all occurrences of a token in the filerget thing at pointsget locals identifierstevaluate an expressionu0get all names in scope (GHC API) vget cabal dependencieswget cabal componentsxclean imports in a source filey$clean generated and copied files aZif true copy all files, if false only copy files newer than their corresponding temp files:return the list of files copied, the list of files deletedbaalways copy the file, if false only copy the file if it is newer than its corresponding temp file%the source file in the project folder0return Nothing if no copy or Just file if copiedc&the source file in the project folder  the contents duse the source or temp cabal True if configure succeedede=do we want output (True) or just compilation without linking?%use original cabal or temp cabal filef4should we return all files or only the changed ones?the cabal component namegthe source file8the cabal component to use, or Nothing if not specified *Just names in scope if build is successfulhthe source file8the cabal component to use, or Nothing if not specified True if build is successfulithe build flags the file to preprocessthe resulting codejthe source file8the cabal component to use, or Nothing if not specified kthe source file8the cabal component to use, or Nothing if not specified lthe source file8the cabal component to use, or Nothing if not specified mthe source file8the cabal component to use, or Nothing if not specified nthe source file8the cabal component to use, or Nothing if not specified o source file8the cabal component to use, or Nothing if not specified pthe source fileqthe source filethe token to search for8the cabal component to use, or Nothing if not specified rthe source filethe line the columnthe cabal component to use, or Nothing if not specified -> Bool -- ^ do we want the result qualified? -> Bool -- ^ do we want the result typed?sthe source filethe start linethe start column the end linethe end column8the cabal component to use, or Nothing if not specified tthe source file expression8the cabal component to use, or Nothing if not specified u8the cabal component to use, or Nothing if not specified vwxthe source fileformat?8the cabal component to use, or Nothing if not specified y everything?abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxy        !"#$%&'()*+,-./012234567899:;<=>>?@ABBCDEFGHIJJKLMNOOPQRSTUVWXYZZ[\]]^_`abcdeefghiijkllmnopqrstuvwxyz{|}~~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_!`abcdefghijklmnopqrstuvwxyz{|}~buildwrapper-0.8.11"Language.Haskell.BuildWrapper.Base#Language.Haskell.BuildWrapper.Cabal!Language.Haskell.BuildWrapper.GHC!Language.Haskell.BuildWrapper.API(Language.Haskell.BuildWrapper.GHCStorageGHCMessages!Language.Haskell.BuildWrapper.Src EvalResulterTypeerResulterErrorUsage usPackageusModuleusName usSectionusTypeusLocusDef LoadContents MultipleFilelmFiles SingleFilelmFilelmModule ImportCleanicSpanicText CabalPackagecpName cpVersion cpExposed cpDependent cpModulesCabalComponent CCBenchmark ccBenchName CCTestSuite ccTestName CCExecutable ccExeName CCLibrary ccBuildable Verbosity DeafeningVerboseNormalSilent ThingAtPointtapName tapModuletapTypetapQTypetapHTypetapGType BuildFlagsbfAst bfPreproc bfModName bfComponent OutlineResult orOutline orExports orImports ImportDefiModuleiPackageiLoc iQualifiediHidingiAlias iChildren ImportSpecDefisNameisTypeisLoc isChildren ExportDefeNameeTypeeLoc eChildrenImportExportTypeIEModule IEThingWith IEThingAllIEAbsIEVarTokenDeftdNametdLoc OutlineDefodNameodTypeodLoc odChildren odSignature odCommentodStartLineCommentNameDefndNamendType ndSignature InFileSpanifsStartifsEnd InFileLociflLine iflColumnOutlineDefTypeSplice ConstructorFieldInstanceTypeSynPatternFunctionFamilyDataClass WhichCabalTargetSource BuildResultOpResultBWNote bwnStatusbwnTitle bwnLocation BWLocationbwlSrcbwlLinebwlCol bwlEndLine bwlEndCol BWNoteStatus BWWarningBWErrorBuildWrapperState tempFolder cabalPath cabalFile verbosity cabalFlags cabalOpts logCabalArgs BuildWrapperreadObj mkEmptySpan isBWNoteError ifsOverlap iflOverlap mkFileSpan mkOutlineDefmkOutlineDefWithChildrengetFullTempDir getDistDir getTargetPathcanonicalizeFullPath getFullSrc copyFromMainisSourceMoreRecent fileToModulecabalComponentName getLoadFilesgetRecursiveContentsgetRecursiveContentsHidden deleteGhosts deleteTempdeleteGenerated fromJustDebug removeBaseDirnubOrd formatJSONreadFile writeFilewithBinaryFile splitString$fFromJSONEvalResult$fToJSONEvalResult$fNFDataEvalResult$fFromJSONImportClean$fToJSONImportClean$fFromJSONCabalPackage$fToJSONCabalPackage$fFromJSONCabalComponent$fToJSONCabalComponent$fFromJSONThingAtPoint$fToJSONThingAtPoint$fFromJSONBuildFlags$fToJSONBuildFlags$fFromJSONOutlineResult$fToJSONOutlineResult$fFromJSONImportDef$fToJSONImportDef$fFromJSONImportSpecDef$fToJSONImportSpecDef$fFromJSONExportDef$fToJSONExportDef$fFromJSONImportExportType$fToJSONImportExportType$fFromJSONTokenDef$fToJSONTokenDef$fFromJSONOutlineDef$fToJSONOutlineDef$fFromJSONNameDef$fToJSONNameDef$fFromJSONInFileSpan$fToJSONInFileSpan$fFromJSONOutlineDefType$fToJSONOutlineDefType$fFromJSONBuildResult$fToJSONBuildResult$fFromJSONBWNote$fToJSONBWNote$fNFDataBWNote$fFromJSONBWLocation$fToJSONBWLocation$fNFDataBWLocation$fFromJSONBWNoteStatus$fToJSONBWNoteStatusCabalBuildInfo cbiTargetcbiBuildFolder cbiIsLibrarycbiModulePaths cbiComponentgetCabalLibraryVersiongetFilesToCopycabalV cabalBuild cabalBuild' targetFilecabalConfigure getCabalFilegetPackageName cabalInit withCabalparseCabalMessagessetupExefromCabalDevExe dropPrefixesstripPrefixIfNeeded addCurrentcabalErrorLineparseBuildMessagesvalidLocreadInt tryReadListmakeNote getBuiltPathcanonicalizeBuildInfoonModulePathsM onModulePaths getBuildInfo setOptionsfileGhcOptionsfileCppOptionscabalExtensions getSourceDirs getAllFiles getBuildDirgetReferencedFilesstringToModuleNamemoduleToStringcabalComponentscabalDependencies dependenciescabalComponentsFromDescriptioncabalComponentsDependenciescabalComponentFromTargetcabalComponentFromLibrarycabalComponentFromExecutablecabalComponentFromTestSuitecabalComponentFromBenchmarkFinalImportMapFinalImportValueTypeMap ImportMapAliasMap PPBehaviorContinuePragmaStartIndentContinueGHCApplyFunctiongetASTwithAST withJSONAST withASTNotesinitGHCghcWithASTNotes isWarnIsErrorghcMessagesToNotesgetGhcNamesInScopegetGhcNameDefsInScope getGhcNameDefsInScopeLongRunninggetEvalResultsname2ndgetThingAtPointJSON getLocalsJSONevalghcSpanToLocationghcSpanToBWLocationghcColToScionColscionColToGhcColghctokensArbitraryghctokensArbitrary'lexTokenStreamHlexLoc lexerFlags ofInterest tokenToTypetokenTypesArbitrarytokenTypesArbitrary' occurrences occurrences'generateTokensgenerateTokens'preprocessSourceghcErrMsgToNoteghcWarnMsgToNote ghcMsgToNote removeStatusmkUnqualTokenValuemkQualifiedTokenValue mkTokenName tokenTypedotFS tokenValuestartendghcImportToUsage ghcLIEToUsageghcExportToUsageghcNameToUsage ghcImportMapghcCleanImports $fMonoidBag synchronize synchronize1write configurebuild generateUsagebuild1build1LongRunningpreproc getBuildFlags getGHCAST withGHCAST withGHCAST' getOutline getTokenTypesgetOccurrencesgetThingAtPoint getLocalsevalExpressiongetNamesInScopegetCabalDependenciesgetCabalComponents cleanImportscleanFindFunc getInfoFile getUsageFile clearInfostoreBuildFlagsInfogenerateGHCInfo storeGHCInfo readGHCInforeadBuildFlagsInfo setStoredInforeadStoredInfo setUsageInfo getUsageInfo dataToJSONgetTypeshowSD showSDUser showSDDump srcSpanToJSON srcLocToJSONtypesInsideTypefindInJSONFormattedfindInJSONData findInJSON findAllInJSONlastPosoverlapcontains isGHCType extractUsages extractName extractSourceextractSourceSpanextractSourceLoc identOfExpr getHSEAST getHSEOutlinegetModuleLocationbuildCommentMapgetHSEImportExportnameDecl cnameDecl qnameDecl mnnameDeclmakeSpanknownExtensionNames