zf      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdeghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Infered Similar to f , but using g rather than h. if-then-else lifted over a i. if-then lifted over a i. NCatch a failing monadic computation, making it succeed with a constant value. <Catch a failing monadic computation, making it succeed with j. <Catch a failing monadic computation, making it succeed with k. -Determine if a monadic computation succeeds.  Fail if the i succeeds; succeed with () if it fails. *Apply a pure function to the result of an l. ,Apply a pure function to the argument to an l.  Synonym for m.  Synonym for n. Look at the argument to the l before choosing which l to use. Look at the argument to an l@, and choose to be either the identity arrow or the zero arrow. Catch a failing o, making it into an identity. Catch a failing o), making it succeed with a Boolean flag.  Useful when defining anyR instances.  Makes an l5 fail if the result value equals the argument value.  Repeat an o< until it fails, then return the result before the failure. 3 Requires at least the first attempt to succeed.  Attempts two Arrows2s in sequence, succeeding if one or both succeed. Sequence a list of ls, succeeding if any succeed. Sequence a list of l#s, succeeding if they all succeed.     ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-InferedA < is a way to focus in on a particular point in a structure. A  is a . that shares the same source and target type. \ is a translation or strategy that translates from a value in a context to a monadic value. Apply a  to a value and its context. !The primitive way of building a .  The primitive way of building a . Build a  that doesn't depend on the context. Build a constant  from a monadic computation. Extract the current context. &Expose the current context and value. Map a  over a list. !!$ is the primitive way of building a . " Identity . #Catch a failing endo, making it into an identity. $Composition of s. %Sequence a list of endos. & Construct a  from two pure functions. 'Apply a  at a point specified by a . (Apply a  at a point specified by a . pLifting through the iE and a Reader transformer, where (c,a) is the read-only environment. qThe r l induced by m., lifting through a Reader transformer, where c is the read-only environment. sThe r l induced by m., lifting through a Reader transformer, where c is the read-only environment. tThe r l induced by m., lifting through a Reader transformer, where c is the read-only environment. uThe r l induced by m., lifting through a Reader transformer, where c is the read-only environment. vThe r w induced by m., lifting through a Reader transformer, where c is the read-only environment. xPLifting through a Reader transformer, where (c,a) is the read-only environment. yPLifting through a Reader transformer, where (c,a) is the read-only environment. zPLifting through a Reader transformer, where (c,a) is the read-only environment. {PLifting through a Reader transformer, where (c,a) is the read-only environment. |PLifting through a Reader transformer, where (c,a) is the read-only environment.  !"#$%&'(pqstuvxyz{| !"#$%&'( !"#$%&'( !"#$%&'(pqstuvxyz{|ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Infered )$A class of injective functions from a to b, and their retractions. * The following law is expected to hold:  retract (inject a) == Just a ,$Injects a value and lifts it into a i. -%Retracts a value and lifts it into a } , producing h if the retraction fails. .Lifted *. /Lifted +, the  fails if the retraction fails. 0 Convert a  over an injected value into a  over a non-injected value. 1 Promote a  over a value into a " over an injection of that value, 9 (failing if that injected value cannot be retracted). 2 Convert a  over an injected value into a " over a retraction of that value, 9 (failing if that injected value cannot be retracted). 3 Promote a  into over a value into a " over an injection of that value, 9 (failing if that injected value cannot be retracted). 4A  to the injection of a value. 5A  to the retraction of a value. ~.There is an identity injection for all types. )*+,-./012345~ )*+,-./012345 )*+,-./012345 )*+,-./012345~ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Infered6A 6 is a list of s, where each ? specifies which interesting child to descend to at each step. 77% captures the ability to walk over a < applying s,  using a specific context c and a } m. Minimal complete definition: 8. #Default instances are provided for 9, : and ;-, but they may be overridden for efficiency. d For small numbers of interesting children this will not be an issue, but for a large number, say & for a list of children, it may be. 8 Construct a 6 pointing at the n-th interesting child of this node. 9Apply a = K to all interesting children of this node, succeeding if they all succeed. ! The results are combined in a . :Apply a = K to all interesting children of this node, succeeding if they all succeed. ;Apply = E to all interesting children of this node, suceeding if any succeed. <A <? is any node in the tree that you wish to be able to traverse. === is a sum of all the interesting sub-types, transitively, of a.  We use  Generic a ~ a/ to signify that something is its own Generic. 1 Simple expression types might be their own sole =, more complex examples " will have a new datatype for the =*, which will also be an instance of class <. >*Count the number of interesting children. ?Apply a  to a specific child. @Apply a  to a specific child. A1Fold a tree in a top-down manner, using a single  for each node. B2Fold a tree in a bottom-up manner, using a single  for each node. CAttempt to apply a . in a top-down manner, prunning at successes. D<An always successful top-down fold, replacing failures with j. E=An always successful bottom-up fold, replacing failures with j. FApply a 7 in a top-down manner, succeeding if they all succeed. GApply a 2 in a top-down manner, succeeding if any succeed. HApply a 8 in a bottom-up manner, succeeding if they all succeed. IApply a 3 in a bottom-up manner, succeeding if any succeed. JApply a J twice, in a top-down and bottom-up way, using one single tree traversal, # succeeding if they all succeed. KApply a J twice, in a top-down and bottom-up way, using one single tree traversal,  succeeding if any succeed. LAttempt to apply a 8 in a top-down manner, prunning at successful rewrites. M:A fixed-point traveral, starting with the innermost term. N Construct a  by following a 6. O Construct a + that points to the last node at which the 6 can be followed. P!Repeat as many iterations of the 6 as possible. 6789:;<=>?@ABCDEFGHIJKLMNOP6789:;<=>?@ABCDEFGHIJKLMNOP<=>789:;@FGHIJKLM?ABCDE6NOP6789:;<=>?@ABCDEFGHIJKLMNOPghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-InferedY A failing J with a standard error message for when the child index is out of bounds. QRSTUVWXYZ[\]^_`abcdeQRSTUVWXYZ[\]^_`abcdeQRSTUVWXYZ[\]^_`abcdeQRSTUVWXYZ[\]^_`abcdeghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-InferedD  !"#$%&'(6789:;<=>?@ABCDEFGHIJKLMNOP      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnloplmqlorlstluvlwxlyzlw{lw|}~lwlylmls kure-2.0.0Language.KURE.CombinatorsLanguage.KURE.TranslateLanguage.KURE.InjectionLanguage.KURE.WalkerLanguage.KURE.Utilities Language.KURE guardFailcondMwhenMtryMmtryMattemptMtestMnotMresultargumentidR<+readerRacceptRtryRattemptRchangedRrepeatR>+>orRandRLensRewrite Translateapply translaterewrite contextfreeTconstTcontextTexposeTmapTlensidLtryLcomposeL sequenceLpureLfocusRfocusT InjectioninjectretractinjectMretractMinjectTretractTextractTpromoteTextractRpromoteRinjectLretractLPathWalkerchildLallTallRanyRTermGeneric numChildrenchildTchildRfoldtdTfoldbuTtdpruneTcrushtdTcrushbuTalltdRanytdRallbuRanybuRallduRanyduRtdpruneR innermostRpathL exhaustPathL repeatPathL allTgeneric allRgeneric anyRgeneric childLgeneric attemptAny2 attemptAny3 attemptAnyN attemptAny1N missingChildL childLaux childL0of1 childL0of2 childL1of2 childL0of3 childL1of3 childL2of3 childL0of4 childL1of4 childL2of4 childL3of4 childLMofNbase Control.MonadguardGHC.BasefailmzeroMonad Data.Monoidmempty Data.MaybeNothing Control.ArrowArrowControl.Categoryid<+> ArrowPlus$fMonoidTranslate$fArrowApplyTranslateKleisli$fArrowPlusTranslate$fArrowZeroTranslate$fArrowTranslate$fCategoryTranslateCategory$fMonadPlusTranslate$fMonadTranslate$fAlternativeTranslate$fApplicativeTranslate$fFunctorTranslate MonadPlus $fInjectionaa$fInjectionaMaybeghc-prim GHC.TypesIntMonoid