Annotations of Function Calls
In the output of the analysis you find an annotated function type for each function that has been defined in the RAML program. This type describes the resource consumption of the function with respect to the selected resource metric.
However, if a function is used in another expression then the function type is in general not the function type that is presented in the output of the analysis. The reason is that you often have to pass on potential to the result of a function. This passed-on potential can then be used to account for the resource consumption of the evaluation of the whole expression.
As a result, a function can have a different annotated type for every function call. To allow the output of the function types for function applications we introduced labels for function calls. Assume you have defined a function g that calls a function f in its body:
g(x) = 5 + f(x) + f(x*2)
To see the annotated function type that is used for f in the first call f(x), you can introduce a label first_call_in_g:
g(x) = 5 + {first_call_in_g}f(x) + f(x*2)
In the output of the analysis you will now find the annotated type of the function {first_call_in_g}f. This type is the type that was inferred for the labeled function call.
You can introduce as many labels as you like. All the corresponding function types will be printed. However, each label has to have a unique name.




