úÎpplK=      !"#$%&'()*+,-./0123456789:;< Safe-Inferred!"=HM  The type  encodes a  l-transformer. It is usually used to transform references from an actual environment to the final one. The type * is the type of the result of "running" a Trafo. Because sG could be anything we have to hide it using existential quantification.When the types def and use of an Æ coincide, we can be sure that the references in the terms do not point to values outside the environment but point to terms representing the right type. This kind of environment is the final environment of a transformation. The type Env term use def4 represents a sequence of instantiations of type forall a. term a use , where all the instances of a% are stored in the type parameter def . The type use^ is a sequence containing the types to which may be referred from within terms of type  term a use. The   type encodes type equality. The  ò type for represents typed indices which are labeled with both the type of value to which they refer and the type of the environment (a nested Cartesian product, growing to the right) in which this value lives. The constructor J expresses that the first element of the environment has to be of type a. The constructor l does not care about the type of the first element in the environment, being polymorphic in the type b. The function l compares two references for equality. If they refer to the same element in the environment the value Just Eq\ is returned, expressing the fact that the types of the referred values are the same too. The function D returns the element indexed in the environment parameter by the  < parameter. The types guarantee that the lookup succeeds. The function l takes an additional function as argument, which is used to update the value the reference addresses.         Safe-Inferred!"=HM #Alternative version of #Ë where the universal quantification over |s| is moved inside the quantification over |env2|. Note that the type variables |a| and |b| are now labelled with |s|, and hence have kind |(* -> *)|.% The function % takes as arguments the #g we want to run, meta-information for the empty environment, and an input value. The result of % (type ) is the final environment ( Env t s s-) together with the resulting meta-data (m s), and the output value (b s). The rank-2 type for  runTrafo2h ensures that transformation steps cannot make any assumptions about the type of final environment (s&). It is an alternative version of % which does not use  unsafeCoerce.& The Trafo2 newSRef2§ takes a typed term as input, adds it to the environment and yields a reference pointing to this value. No meta-information on the environment is recorded by newSRef2 ; therefore we use the type  for the meta-data. ' The function ' returns a !& that extends the current environment.( The function ( returns a !s that casts the reference passed as parameter (in the constructed environment) to one in the final environment.) The function ) returns a !e that updates the value pointed by the reference passed as parameter into the current environment.* The function * returns a # that introduces a function ((UpdFinalEnv t)") to update the final environment.+<Change the final environment by the one passed in the input.,'Return as output the final environment..The combinator  sequenceA2$ sequentially composes a list of Trafo2 s into a Trafo2 that yields a 7 of outputs. Its use is analogous to the combinator = combinator for >s.)?@A BCDEFGHI!"#$%&'()*+,-./JKL0  !"#$%&'()*+,-./#$!"&'(),+*% -./?@A BCDEFGHI!"#$%&'()*+,-./JKLNone!"=HM 0 The type 0J is used to introduce an existential quantifier into the definition of 2. It can be seen that a 2/ is a function taking as arguments: the input (a), a  -transformer (T env2 s_) from the environment constructed in this step to the final environment, the environment ( Env t s env1K) where the current transformation starts and the "final environment" ( FinalEnv t sO) with the updates thus far applied. The function returns: the output (b ), a  -transformer (T env1 s[) from the initial environment of this step to the final environment, the environment ( Env t s env29) constructed in this step and the final environment ( FinalEnv t s) possibly updated.2 The type 2X is the type of the transformation steps on a heterogeneous collection. The argument mË stands for the type of the meta-data. A |Trafo| takes the meta-data on the current environment |env1| as input and yields meta-data for the (possibly extended) environment |env2|. The type tJ is the type of the terms stored in the environment. The type variable s] represents the type of the final result, which we do expose. Its role is similar to the s in the type ST s a. The arguments a and b0 are the Arrow's input and output, respectively.4 The Trafo 4§ takes a typed term as input, adds it to the environment and yields a reference pointing to this value. No meta-information on the environment is recorded by 4 ; therefore we use the type  for the meta-data. 5<Change the final environment by the one passed in the input.6'Return as output the final environment.7 The function 7 returns a 2E that updates the final environment using the input function (FinalEnv t s -> FinalEnv t s).8 The function 8 returns a 0& that extends the current environment.9 The function 9 returns a 0s that casts the reference passed as parameter (in the constructed environment) to one in the final environment.: The function : returns a 0e that updates the value pointed by the reference passed as parameter into the current environment.; The function ; takes as arguments the 2g we want to run, meta-information for the empty environment, and an input value. The result of ; (type ) is the final environment ( Env t s s-) together with the resulting meta-data (m s), and the output value (b s). The rank-2 type for ;h ensures that transformation steps cannot make any assumptions about the type of final environment (s).<The combinator <$ sequentially composes a list of 2 s into a 2J that yields a list of outputs. Its use is analogous to the combinator = combinator for >s.0123456789:;<MNOP" 0123456789:;< 2301489:657;<0123456789:;<MNOPQ      !!""#$%&'()*+,-!!""$)*(%&'#,./0.123456789::;;<=>?@ABC TTTAS-0.6.0$Language.AbstractSyntax.TTTAS.CommonLanguage.AbstractSyntax.TTTAS2Language.AbstractSyntax.TTTASTunTResultFinalEnvUnitEnvExtEmptyEqualEqRefSucZeromatchlookupupdate lookupEnv updateEnvList ArrowLoop2loopArrow2arrfirstsecond***&&&PairPTrafoETraforunTrafonewSRefextEnvcastSRef updateSRefupdateFinalEnv putFinalEnv getFinalEnv>>> sequenceAreturnAbase Control.MonadsequenceGHC.BaseMonad Category2id2.:. FinalEnv2Final UpdFinalEnvUpdSIFUpd$fArrowLoop2Trafo $fArrow2Trafo$fCategory2Trafo$fArrowLoopTrafo $fArrowTrafo$fCategory*Trafo$fFunctorTrafoE