~      !"#$%&'()*+,-./01234567 8 9 : ; < = > ? @ 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 [ \ ] ^ _ ` a b c defghijklmnopqrstuvwxyz{|}~ Safe-InferredFThis function applies a String to String function to a certain String * (everything in the context of the module Prelude). It is expensive as it calls ghc% to produce its results. It has been & created to formally provide the mode  'apply-to' but text editors should  instead use ghc8 directly. The first argument control whether a warning N message describing this fact is contained in the result. If it is False then J the second tuple element of the result will contain an according warning  otherwise it Nothing. ?The result is a tuple of which the first elements contains the $ (stdout-)output of the call to the ghc$ and the second element may contain K warning messages. If the first function argument is False then the second M tuple element will never be Nothing. Otherwise it may be Nothing or contain 4 a messages (for example when the executable GHC isn' f found). NoneGThis is a wrapper around runGhc which allows to pass some command line  options. JThis function takes ghc-specific command line flags and inserts them into I the GHC monad. The passed Ghc action is then executed in an environment G where these flags have been applied. Principally there are 3 types of  flags for GHC:  dynamic flags 9 static flags (they may change during one compiler run)  mode flags (e.g. --make) MThis function only processes dynamic and static flags. They should be passed # as specified on the command line:    runGhcWithCmdLineFlags [-isrc,-XDeriveDataTypeable] (Just libdir) someAction LThis function will throw an exception if any of the specified options leads # to a warning or cannot be parsed. FTakes a module summary and returnes the renamed abstract syntax tree. LThis is a small auxiliary function that takes a module summary and extracts M the renamed abstract syntax tree from it. The syntax tree is represented by $ the data structure HsGroup in GHC. KA small auxiliary function that updates the dynamic flags to suppress file  output. =This function takes a file name or a module and searches the L module-summary which is based on this source file out of the module graph. HThis function creates a target from the passed file name by applying to  most common used settings. Wrapper around  and " that treats the common case of a  one-file-target.     None KThis function takes a filename and an expression and evaluates the type of J this expression in the context of the passed file. The result value is a J tuple where the first element is GHCs representation of the type and the 4 second one is the stringified version of the type. )The first two command line parameter is: F The GHC options as string list (as they should appear on the command  line, e.g. ["-isrc"]) EThis function creates a string of the result returned by exprtype or  exprtypeM. LThe string has exactly the format that should be understood by text editors  that are using this mode. KThis is a variant of exprtype that runs within the GHC monad and therefore ? allows a more fine-grained control over the behaviour of GHC.     None This function is similar to  everythingBut! from the SYB schemes but uses a J neutral element and automatically omits elements of the renamed AST that  mustn't be evaluated. FUses SYB to create generic transformation that omits elements of type  +. This is needed because after the renamer  PostTcTypes must not  be evaluated. FUses SYB to create generic transformation that omits elements of type  +. This is needed because after the renamer  (the element  . in function bindings) must not be evaluated. JThe default traversal functions of the SYB package lack a generic monadic O transformation where certain cases can be excluded. We want this case because F we want to use the Writer Monad and certain cases that should not be  evaluated must be omitted.      Safe-InferredEInstances of this data type control whether the non-first lines of a  binding in mode inline or  smart-inline# should get some extra indentation K to match the environment of the place where the binding should be written  to. #Assumed that the following call to  factorial should get inlined:    result = factorial 3  The function  factorial looks this way:    factorial 1 = 1 # factorial x = x * factorial (x-1) -The lambda function that is produced in mode inline with IgnoreIndOfTargetEnv  looks as follows:    (x -> case x of 1 -> 1 . y -> y * factorial (y - 1)) %The lambda function produced in mode inline with AdaptIndToTargetEnv  looks as follows:   (x -> case x of 1 -> 1 7 y -> y * factorial (y - 1)) $Preserve indentation which means don't adapt 5 the indentation to the environment of the caller. (Increase indentation of non-first lines 3 by the column number the inlined version of the 4 the function starts at (short: adapt indentation  to caller environment) NoneCThis alias can be used to have a meaningful name for indentations. This is a file/(text portion buffered as list of lines. FLine buffers are used to avoid repeated IO operations and to describe > line-oriented content (for example at assembling the TTree). 3A BufSpan is simply defined by two times a BufLoc. BufSpan startLoc endLoc CThis is just the combination of a line number and a column number. BufLoc line column (Returns the start location of a BufSpan &Returns the end location of a BufSpan CDeconstructs a RealSrcSpan to the types more often used in libhbb. DThis function converts a location in the form libhbb uses it into a 3 string. The string has the format that is used by 'occurrences-of' and  locate$ to report locations to the client. DThis is an auxiliary function that splits a string at all newlines. JNote that lines from Prelude cannot be used here. The reason is following  example:   lines "| ->\n" = ["| ->"]  str2LineBuf "| ->\n" = ["| ->",""]  $Converts a line buffer to a string.  Note that  doesn't work here because it doesn't treat the last line  correctly. !IFor a line buffer this function returns the number of spaces charachters , of the line with the smallest indentation. "DCompares two non-overlapping RealSrcSpan elements by their starting  location. #BConverts a RealSrcLoc into a BufLoc effectively throwing away the  filename. $DConverts a RealSrcSpan into a BufSpan effectively throwing away the  filename. %CCreates a BufSpan where the first and the last BufLoc is the same. BThe first parameter is the line and the second one is the column. &HThis function splits the passed lines (of a file-cache) at the position  passed as second parameter. LNote that the line- and column-counts start with 1 (this is GHC behaviour). M The split contains the character pointed to by the BufLoc in the right part  of the tuple. DThis means that (in case of line=1 and column=1) following applies:   splitAtBufLoc " hello world" loc == ([""],[" hello world"]) 'GThis function splits a number of input lines in a way so that the area 3 located to by the passed source span is isolated. )The three areas in the return tuple are: " Initial lines (they come first) 1 Subject lines (they are between the locations) 4 Trailing lines (they come after the last location) MThe last line of initLines and the first line of subjLines must be joined to F reproduce the output. The same applies to subjLines and traiLines... (LThis function returns true if the first RealSrcSpan points to a region that A is located before the one pointed to by the second RealSrcSpan. KThe two spans must be disjoint otherwise the results are undefined (can be  checked with the function ))! )CThis function returns true when the two passed RealSrcSpans do not  overlap. LThis means that the end of the first RealSrcSpan is smaller or equal to the 1 start of the second RealSrcSpan and vice versa. *0This function is the opposite of splitAtBufLoc. IIt can rejoin a split concerning that the last and the first line in the M frist respective second element of the split tuple must be joined by string H concatenation. This function has been designed to run with linear time  complexity. +IThis function combines two times joinSplit to be able to join lines that  have been split by a SrcSpan. KBufLocs are shown by separating the line and the column number by a colon. 2The current working dir (to make pathes relative)  The path that should be adapted 3The current working dir (to force relative pathes) $The location to convert to a string  !"#$%&'()*+ !"#$%&'()*+ !"#$%&'()*+ !"#$%&'()*+None-GThis is the generic data structure representing a transformation tree. T ransformationTree CThe transformation tree is a recursive data structure to represent N modifications to text (files). It is used to represent the changes to source - code made by the inlining function feature.  Cover-Range HThe cover-range is the snippet of code that should be hidden by the new L text. For the root of the tree this is a RealSrcSpan (which has a filename N attached). For other location the cover-range refers to the text inserted by  the parent element. Children MThe text that has been added by for example an addition may be altered again L by the usage of nested transformations. These transformations always refer N to their parent transformation whichs means that the Cover-Range for example M contains lines- and column-indices which refer only to the snipped added by M their parent transformation (and not the whole text which is referred to by I the top-most addition or display). INVARIANT: Moreover the source-spans F elements of child-transformations must be disjoint. Reassembling the K transformation-tree can so be done by sorting the child-tranformations by H their cover-range in reverse order (so that the last position is taken  first) and applying them. 2Instance of TTree produced by ConvertibleToTTree:  ) TTree LineBuf RealSrcSpan InsertionInfo /Instance of TTree that is searialized to JSON: ) TTree LineBuf (RealSrcSpan,Int) BufSpan ,-./0123456 ,-./0123456 /10-.,23456,-./1023456 None:EThis type holds possible return values of getVariableIdUsingLexerAt. =GThis function uses GHCs lexer to determine the token that is under the  cursor (the passed SrcLoc). LCurrently only the tokens ITvarid (a variable id) and ITqvarid (a qualified L variable id) are supported. If IncludeQualified euqal ExcludeQualifiedVars I then ITqvarid will be ignored. A token of type ITqvarid has two strings F attached, the name of the module (the qualifier) and the name of the D variable. Of these twos only the name is contained by the result. 789:;<=789:;<==:<;798798:<;= None?;There is something that is currently not supported (e.g. a  type declaration). @5The location specified points to a function or value  bindings signature. A<Function parameters are of type (LPat Name) at the location  where they are defined. B The token pointed to a binding. C=Names are just pointers to other things. When such a name is 8 discovered, another run of WhatIsAt is triggered which > searches for the thing that is at the location pointed to by > this name. This can only be a binding (ThereIsABinding) or a , function parameter (ThereIsAFunParameter). D(I)mport/.(E)xport declaration that points to the thing  stored as first parameter. E(I)mport/,(E)xport declaration that points to another  compilation unit (package). F;Names are used for value- and function bindings as well as @ function parameters. External names refer to things outside of 3 the module graph (external libraries for example) *This is a internal type used by whatIsAt. G9These are exceptions searchFunctionBinding(M) may throw. AEach exception can be converted to a meaningful string. Moreover H searchFunctionBinding is throwing internal errors via error (exception  ErrorCall must be catched). Q6GHC internally uses Outputable for things that may be = printed to the user for example. As the printing functions 4 depend on the DynFlags used at compilation they can't be 1 used any more when the GHC run has finished. So Q ; uses a closure to save the DynFlags in a curried function 1 to make it possible for clients to get a string - representation of a GHC internal data type. R9This is the Src-Span covering the full function name the 4 searchFunctionBinding function has determined (the 5 function gets passed only a certain point in a file , pointing to a (part) of the function name) S:The name that was at the location that has been passed to < searchFunctionBinding(M). In the case of inlining the name < is what is to be replaced by the function definition. This ) name is completely enclosed by occSpan. T7The type of the result is determined by the GenericQ a  passed as parameter. UIParses the renamed AST of the module and returns all elements that start = at the passed location sorted by length in increasing oder. VIThis function takes a file name and the location that is of interest and M searches out the value or function binding for the name that stands at this K location. The returned value contains all informations that are needed to M inline the function definition or describe how to inline it (smart-inline). KIf the name refers to a name that is not part of the module graph (because G it has been loaded by a library for example) this function will fail. WHThis version to search a function binding takes a Name and some details  about it. XDThis is a generic function that takes informations about a Name and 6 queries the renamed AST according to the parameters. YHThis function is responsible to detect what kind of thing is located at " the passed location (the token). ZGThis function extracts the RealSrcSpan elements of a function binding. L The problem is that a function binding may contain several entry points of G which each has its own src-span attached. Each of these spans will be 9 contained by the result list produced by this function. This is the heading  myfunction in myfunction x = x * x. '>?@ABCDEFGHIJKLMNOPQRSTUCTells how to extract the span of an a. If the a element is at the H BufLoc specified then the according BufSpan is returned. Note that the H results are sorted by the end location of the BufSpan that is returned F here. So if this function returns weird data then the sorting of the  results is not warranted. -The filename of the module to be considered. +The required start-location of the tokens. A sorted list of results. VWXAinformations about the Name instance, its location and the file neutral result function to join 2 results &generic query (special cases) for the  result, produced by  for example... Y"The file where the token occurred &The location of the token to consider Z6Length of the function name (determined by the lexer) The actual binding +A list with one name for each match of the  function (or []! if this is a pattern binding or  infix declaration) $:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ$VWXY>FEDCBA@?ZUGMLKJIH:<;OPQRSTN>FEDCBA@?GMLKJIHNOPQRSTUVWXYZ None[[[[ None\<This is the function that allows the deserialization of the  Transformation-Tree from JSON. ]7This function converts the tranformation-tree to JSON. DThis is an example of a tree containing two addition which has been D converted to JSON (the JSON-code has been layouted to make it more  readable):  {  "addition-text": "()",  "children": [  { 7 "addition-text": "\x -> \"hello \" ++ x",  "children": [], & "cover-range": "1:2-1:2"  }  ], ? "cover-range": "examples/PlayHelloPattern.hs,17:16-17:21"  } \]\]]\\] None^9This type is used to have influence on the processing of L testModeApplyTTree. It is possible to activate ANSI color escape sequences = for the text or to enable the printing of the file context. b2These are the default options used for this mode. . libhbb-cli only uses these default settings. cKThis function reads a transformation-tree serialized to JSON from standard L input and applies it which means that it converts it to text. After having 7 it applied the text is returned as one single string. HThis is a helper function for testModeApplyTTree which does most of the  work. ^_`abc^_`abc^_`abc^_`abcNonedJThis function takes a location, searches out what is at this location and K then returns a list of all occurrences of this identifier. This currently 2 works for names of function- and value bindings. eKThis is the monadic version of occurrencesOf which allows to use this mode 4 of operation from a preconfigured GHC environment. fKThis Function formats the results from the occurrencesOf or occurrencesOfM  function. HThis function detects what is at the position specified (the token) and I according to this information it searches all references to this thing. IThis function searches the passed file for variables, import- or export- @ declarations that refer to the name passed as first parameter. dA list of ghc options (e.g. [-isrc]) .The file where the token to rename resides in *The location where the token to rename is >A list of further files which possibly contain this token and ! which should be searched for it ef The result that should be shown defdefdefNoneg"This function implements the mode g. gD takes the name of a file and a position within this file. If this J position points to a value or function binding this function returns the A source-range where the binding is defined. If the position doesn' t point to I an according binding, the function will fail with an exception. In this - case nothing is written to standard output. *The first two command line parameters is: F The GHC options as string list (as they should appear on the command  line, e.g. ["-isrc"]) hCThis function creates a string of the result returned by locate or  locateM. LThe string has exactly the format that should be understood by text editors ! that are using the mode locate. iIThis is a variant of locate that runs within the GHC monad and therefore ? allows a more fine-grained control over the behaviour of GHC. gh0The position that should be converted to string ighigihghiNoneoKThis function turns the (internal) transformation-tree (with the recursive B elements offsets attached) into a transformation-tree the client N understands. This is mostly a task of making the indentation (which first is K attached implicitely) explicit which means that each addition begins with  enough spaces for example. MThe (indentation-)calculations in applyInsertionInfo are kind of complex and  therefore 'indentation.markdown') is a concept-paper which describes some ) details with the help of some examples. jklmno%Element offset of the parent element 3The recursive element offset of the parent element 2 if it is of type IncInline or 0 if it is of type  NewSection 'Recursive element offset' of all parents 3 between the the current element and the root node #The accumulated level offset stack #Parent elemen trailing chars stack 'Effective indentation' of the parent element LNumber of lines in the parent element (for NewSection insertion position) WNumber of NewSection childs the parent element has (for NewSection insertion position) jklmnonomjlkjlkmnoNoner3may convert a where-expression to a let-expression $HsLocalBinds is for example use for where clauses TODO is this still needed? pqrstuvwxyz pqrstuvwxyz vxwtuyszprqprqstuvxwyzNone{"This function implements the mode 'smart-inline'. HSmart-inline takes a location or a span within a file which should be a J function binding (as of 2014-09-16 excluding any parameter) and tries to H produce an inlined version of the function. The inlined version of the J function is described as transformation to the original source code. The E transformation is a JSON string which is formatted according to the $ descriptions in the documentation.   main :: IO ()  main = do [ res <- smartinline ["-isrc"] IgnoreIndOfTargetEnv "example/Example.hs" (BufLoc 14 13) 3 LazyByteString.putStr $ encodeTTreeToJSON res  putStrLn "" If a second location isn'3t passed this function will use GHCs lexer to find H out where the end of the variable or function name is. Consequently to I smart-inline a function and to simultaneously apply it to its arguments G (which is not supported as of 2014-09-16) the second location must be  passed. +The first two command line parameters are: L The GHC options as string list (as they should appear on the command line)  Some options to the mode inline% that change the functions behaviour |=Converts the result of smartinline and smartinlineM to JSON. IThe resulting string has exactly the format that should be understood by 0 text editors that are using mode smart-inline. }HThis function is a performance optimization to showSmartInlineResult as  the resulting bytestring isn't converted back to string. ~JThis function is similar to smartinline except that it runs in a GhcMonad  instance. {|}~-.\]{|}~{~|}-.]\{|}~NoneEThe data type InlineOptions is to alter the behviour of the function  . If  is true , not only prints the inlined version of the 6 function or value binding but also the file context. If  is true " will use ANSI terminal colors to M highlight different logical informations in the inlined version. Colors are G used for areas that are identical with the original function or value K binding (displays) and a bold grey is used for areas that have been added 7 and do not occur in the original binding (additions). 5This value defines the default options for inlining. MMost text editors will need these settings (maybe adaptToTargetEnv should be K adapted). The inlined version of the function or value binding is printed H without ANSI colors and without context but with non-first lines being L indented to a level that allows a text editor to replace the original name  with the return value of mode . "This function implements the mode . KInline takes a location or a span within a file which should be a function L binding (as of 2014-09-16 excluding any parameter) and tries to produce an N inlined version of the function. The inlined version of the function then is  written to standard output.    main :: IO ()  main = inline [" -iexample"] defaultInlineOptions "example/ Example.hs" (BufLoc 14 13) GIt is important to know that the indentation of non-first lines (as of N 2014-09-16) is always adapted to match the indentation of the location where  the name should be replaced.  If a second location isn'3t passed this function will use GHCs lexer to find H out where the end of the variable or function name is. Consequently to M inline a function and to simultaneously apply it to its arguments (which is E not supported as of 2014-09-16) the second location must be passed. -The first three command line parameters are: L The GHC options as string list (as they should appear on the command line)  Some options to the mode % that change the functions behaviour B The path to the GHC library folder (the module GHC.Paths exports   which can be used here) CThis function creates a string of the result returned by inline or  inlineM. LThe string has exactly the format that should be understood by text editors ! that are using the mode inline. 'This is the monadic version of inline. GInstead of taking command line flags to alter the GHC environment this H function can be used with a custom GhcMonad instance which allows more  control about GHCs behaviour.  !"#$%&'()*++,,-./0123456789:;<=>?@AABCDEFGHI J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b b c d e f g h i j k l m n o p p q r s tuvwxyz{|}~                                   libhbb-0.4.0.2Language.Haskell.HBB.ApplyToLanguage.Haskell.HBB.ExprType Language.Haskell.HBB.SmartInline!Language.Haskell.HBB.Internal.GHC!Language.Haskell.HBB.Internal.AST,Language.Haskell.HBB.Internal.InterfaceTypes%Language.Haskell.HBB.Internal.SrcSpan#Language.Haskell.HBB.Internal.TTree#Language.Haskell.HBB.Internal.Lexer*Language.Haskell.HBB.Internal.GHCHighlevel(Language.Haskell.HBB.Internal.TTreeColor'Language.Haskell.HBB.Internal.TTreeJSON)Language.Haskell.HBB.TestModes.ApplyTTree"Language.Haskell.HBB.OccurrencesOfLanguage.Haskell.HBB.Locate+Language.Haskell.HBB.Internal.InternalTTree3Language.Haskell.HBB.Internal.InternalTTreeCreationLanguage.Haskell.HBB.InlineapplyTo ghc-7.6.3TypeRepTypeSrcLoc srcSpanFile RealSrcSpanrunGhcWithCmdLineFlagsextractRenamedAST"updateDynFlagsToSuppressFileOutputsearchModGraphFor fileToTargetloadTargetsFromFilenameexprtypeshowExprTypeResult exprtypeMqueryRenamedASTtransformRenamedASTtransformTypecheckedASTNonFirstLinesIndentingIgnoreIndOfTargetEnvAdaptIndToTargetEnv IndentationLineBufBufSpanBufLoc spanStartspanEndunpackRealSrcSpanpackRealSrcSpan normalisePathshowSpan str2LineBuf lineBuf2StrgetIndentationcompareByStartLoctoBufLoc toBufSpan pointBufSpan splitAtBufLocsplitBufferedLinesAtBufSpanleqdisjoint joinSplitreassembleSplit ClientTTreeTTree TTreeNodeDisplayAddition applyTTreeapplyTTreeGenericgetCacheElementcollectFilenames cacheFilesIncludeQualifiedExcludeQualifiedVarsIncludeQualifiedVarsLexingFailReason VarNotFound LexingFailedgetVariableIdUsingLexerAtWhatIsAtUnknownElementThereIsATypeSigForThereIsAFunParameterThereIsABindingThereIsANameForThereIsAnIEDeclForThereIsAnIEDeclToExternThereIsAnExternalNameSearchTokenExceptionIsntNameOfABindingIsExternalNameIsFunctionApplicationTokenNotEndingAccordinglyTokenIsntANameLexingSearchError FunBindInfoSearchedTokenInfoprintFunoccSpannameresult getThingsAtsearchFunctionBindingMsearchFunctionBindingForNameMsearchTokenForNameMwhatIsAtrealSrcSpansOfBindingapplyColoredTTreedecodeTTreeFromJSONencodeTTreeToJSONApplyTTreeArgsapplyToShowContextapplyToShowAnsiColoreddefaultApplyTTreeArgstestModeApplyTTree occurrencesOfoccurrencesOfMshowOccurrencesOfResultlocateshowLocateResultlocateM InsertionInfo NewSection IncInline InternalTTreeapplyIndentationapplyInsertionInfoLambdaNotationStyleLongNotationWithWhereShortNotationStyleIsValueBindingConvertibleToTTreetoTTreeConversionInfo ProduceEqual ProduceLambdaonDifferentLinescombineRealSrcSpans smartinlineshowSmartInlineResult!showSmartInlineResultAsByteString smartinlineM InlineOptions showContextshowAnsiColoredadaptToTargetEnvdefaultInlineOptionsinlineshowInlineResultinlineMGHC setTargetsGhcMakeloadHsLit PostTcTypeNameSetHsBindsbind_fvseverywhereButMbase Data.Listunlines $fShowBufLoc $fShowBufSpan $fOrdBufLocWhatIsAtIndirection RecFromIEDecl RecFromSig RecFromName NoRecursion FunBindAndSigjoinFunBindAndSig syb-0.4.2Data.Generics.AliasesmkQ$fExceptionSearchTokenException$fShowSearchTokenException TTreeColorDefaultWhiteOnBlackHlCyanCyan HlMagentaMagentaHlBlueBlueHlYellowYellowHlGreenGreenHlRedRedGray additionColor displayColors ansiColorStr attachColors JSON_BufSpan JSON_BufLocJSON_RootTTree JSON_TTreeJSON_DisplaySpanJSON_RealSrcSpan splitAtCharparseJSONTTreeGenerictoJSONTTreeGeneric$fToJSONJSON_RootTTree$fToJSONJSON_TTree$fFromJSONJSON_RootTTree$fFromJSONJSON_TTree$fToJSONJSON_RealSrcSpan$fFromJSONJSON_RealSrcSpan$fToJSONJSON_DisplaySpan$fFromJSONJSON_DisplaySpan$fToJSONJSON_BufSpan$fFromJSONJSON_BufSpan$fToJSONJSON_BufLoc$fFromJSONJSON_BufLoc applyTTree' processTokenaccumulateThingsThatReferAccLevelOffsetRecElementOffsetattachRecusiveElementOffsets elementOffset"$fConvertibleToTTreeHsLocalBindsLR$fConvertibleToTTreeGenLocated$fConvertibleToTTree(,,)$fConvertibleToTTree(,,)0 $fConvertibleToTTreeHsValBindsLR$fConvertibleToTTree(,,)1$fConvertibleToTTreeGenLocated0$fConvertibleToTTree[]ghc-paths-0.1.0.9 GHC.Pathslibdir