úÎ*2'“     portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered p a w replaces the free variable a with p in w ZIf a term has no free variables, you can freely change the type of free variables it uses portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered1Instantces may or may not be monad transformers. If they are, then you can use m >>>= f = m >>= lift . f CThis is useful for types like expression lists, case alternatives, I schemas, etc. that may not be expressions in their own right, but often  contain one. portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered"I am not a number, I am a  free monad!" Var b a) represents variables that may either be bound (B) or free (F)  !" !"portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered   b f a is a an f$ expression with bound variables in b, and free variables in a KThis stores bound variables as their generalized de Bruijn representation,  in that the succ'As for variable ids are allowed to occur anywhere within the tree  permitting O(1)5 weakening and allowing more sharing opportunities. + Here the deBruijn 0 is represented by the  constructor of  , while the  de Bruijn #9 (which may be applied to an entire tree!) is handled by . 6NB: equality and comparison quotient out the distinct  placements allowed by l the choice of a generalized de Bruijn representation and return the same result as a traditional de Bruijn  representation would. 8Capture some free variables in an expression to yield a   with bound variables in b  Abstract over a single variable 1Enter a scope, instantiating all bound variables 8Enter a scope with one bound variable, instantiating it * quotients out the possible placements of  in   I by distributing them all to the leaves. This yields a more traditional 0 de Bruijn indexing scheme for bound variables.   fromScope . toScope = id - fromScope . toScope . fromScope = fromScope ( . ) is idempotent APerform substitution on both bound and free variables in a scope $SThe monad permits substitution on free variables, while preserving bound variables %&< is provides a list (with duplicates) of the free variables  '()*+,-./0$1%2    '()*+,-./0$1%2portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered 3      !"#$%&'()*+',-./0123456789: bound-0.1.3 Bound.Term Bound.Class Bound.Var Bound.ScopeBound substituteclosedisClosed>>>==<<<VarFBScopeunscopeabstract abstract1 instantiate instantiate1 fromScopetoScopesplat $fRead1Var $fShow1Var $fOrd1Var$fEq1Var $fRead2Var $fShow2Var $fOrd2Var$fEq2Var$fBitraversableVar$fBifoldableVar$fBifunctorVar $fMonadVar$fApplicativeVar$fTraversableVar $fFoldableVar $fFunctorVarbaseGHC.Enumsucc $fMonadScope$fFoldableScope Data.FoldabletoList $fBoundScope $fRead1Scope $fReadScope $fShow1Scope $fShowScope $fOrd1Scope $fOrdScope $fEq1Scope $fEqScope$fMonadTransScope$fTraversableScope$fFunctorScope