1..6      !"#$%&'()*+ , - . / 0 1 2 3 4 5  Safe-Inferred Safe-Inferred'9=Uniform variant of 6, for indexed types. This is different from   p in that it is properly kind polymorphic and crucially heterogeneous, and it places no constraint on the index. Safe-Inferred !"'(9=HJKMT 7   7 Safe-Inferred !"(9=HMT v is the type of variables; o5 is the type of operators parameterized by arities; n3 is the "higher type" of the term (i.e. a term has n=0, a single binding has n=1 , etc.); B is the functor which interprets the inner structure of the view.Views are a (higher) functor. a natural transformation  !  a view at        Safe-Inferred  Safe-Inferred'9=Uniform variant of 8, for indexed types. This is different from   ) in that it is properly kind polymorphic. Safe-Inferred689Generates a fresh variable-Generates a fresh variable tagged with a name Safe-Inferred!"(689= The y signature represents mediation between an arbitrary (possibly nameless) term representaion, and a first-order one (the  (). Based on the (effectful) ismorphism  /  between representations, many operations can be defined generically for arbitrary operator sets, including substitution and aggregation of free variables. Convert a   into a term."Convert a term into a first-order  .&The injection from variables to terms.Construct an abstraction.Construct an operator term.!Substitute a term for a variable.1Instantiate the bound variable of an abstraction.%Compute the free variables of a term.+Render a term into a human-readable string.     Safe-Inferred !"(2469=T )Locally nameless terms with operators in o at arity n.%JA variable is a De Bruijn index, optionally decorated with a display name.) A lens for '. varName "7 Lens' % (9 :) * A lens for (. varIndex "7 Lens' % ;  !"#$%&'()*<=>?@AB !"#$%&'()* $#"!%&'()* $#"!%&'()*<=>?@AB Safe-Inferred None !"(369BT+^Next, we'll define the operators for a tiny lambda calculus as a datatype indexed by arities..oWe'll start off with a monad in which to manipulate ABTs; we'll need some state for fresh variable generation.1AWe'll run an ABT computation by starting the variable counter at 0.2Check out the source to see this example term: note that number of arguments and presence of abstractions is guaranteed by the types. The representation is not scope-safe (i.e. free variables are permitted), but that's how we want it.56Check out the source to see fresh variable generation. +,-./012345+,-./012 ./015+-,432+-,./012345C  !"#$%&'()*+,-./012334567 8 9 : ; ; < = > ? @ ABCDEFGHFIJFKLBMNOPQRSTUV abt-0.1.0.0 Abt.Types.NatAbt.Class.HEq1Abt.Types.HListAbt.Types.ViewAbt.Class.Show1Abt.Class.Monad Abt.Class.AbtAbt.Concrete.LocallyNameless Abt.Tutorial Data.FunctorEq1 Abt.TypesShow1 Abt.ClassNatSZHEq1===HList:*Nilhmap htraverse homogenizeAView:$:\VmapView showsPrec1show1MonadVarfreshnamedAbtintooutvar\\$$subst//freeVarstoStringTmAppAbsBoundFreeVar_varName _varIndexvarNamevarIndexLangApLamM_MrunMexample $fHEq1[]Lang $fShow1[]Lang$fMonadVarVarMghc-prim GHC.ClassesEq $fHEq1[]HListbaseGHC.ShowShow Data.MaybeMaybeGHC.BaseString GHC.TypesIntshiftVaraddVar $fAbtVaroTm $fHEq1NatTm$fOrdVar$fEqVar $fShowVar