ų      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl m n o p q r s t u v w x y z { | } ~  ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred 1Apply a pure function to the result of an arrow. 3Apply a pure function to the argument to an arrow. NApply an arrow to the first element of a pair, discarding the second element. NApply an arrow to the second element of a pair, discarding the first element. 0A pure arrow that swaps the elements of a pair. +A pure arrow that duplicates its argument. .Tag the result of an arrow with its argument. .Tag the result of an arrow with its argument. !An arrow with a constant result. .Sequence (from left to right) a collection of s. UApply a collection of arrows to the same input, combining their results in a monoid.     ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred  Similar to guard, but invokes  rather than mzero. As  $, but with a default error message. As  , but with an m Bool as argument. .if-then-else lifted over a monadic predicate. KIf the monadic predicate holds then perform the monadic action, else fail. KIf the monadic predicate holds then fail, else perform the monadic action.     ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred5 is the minimal structure that can be an instance of . ' The KURE user is free to either use  or provide their own monad.   is essentially the same as  , except that it supports a  instance which   does not (because its  method calls ) W A major advantage of this is that monadic pattern match failures are caught safely. s with a catch for . * The following law is expected to hold:  fail msg `catchM` f == f msg %Catch a failing monadic computation. Eliminator for . Get the value from a 1, providing a function to handle the error case. Lift a ! computation to any other monad. 0A monadic catch that ignores the error message. OSelect the first monadic computation that succeeds, discarding any thereafter. NCatch a failing monadic computation, making it succeed with a constant value. <Catch a failing monadic computation, making it succeed with . NCatch a failing monadic computation, making it succeed with an error message. -Determine if a monadic computation succeeds. 7Fail if the monadic computation succeeds; succeed with () if it fails. ;Modify the error message of a failing monadic computation. + Successful computations are unaffected. 8Set the error message of a failing monadic computation. + Successful computations are unaffected. DAdd a prefix to the error message of a failing monadic computation. + Successful computations are unaffected. !MUse the given error message whenever a monadic pattern match failure occurs. "Lift a computation from the / monad, catching failures in the target monad. The String is generated by ing the exception.  !" !"" ! !"ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred#A $. that shares the same source and target type. $DAn abstract representation of a transformation from a value of type a in a context c to a monadic value of type m b.  The $/ type is the basis of the entire KURE library. %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 $ that doesn't depend on the value. *Build a constant $ from a monadic computation. Lifting through the E and a Reader transformer, where (c,a) is the read-only environment. The   induced by m., lifting through a Reader transformer, where c is the read-only environment. The   induced by m., lifting through a Reader transformer, where c is the read-only environment. The   induced by m., lifting through a Reader transformer, where c is the read-only environment. The   induced by m., lifting through a Reader transformer, where c is the read-only environment. The   induced by m., lifting through a Reader transformer, where c 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. 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. 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. PLifting through a Reader transformer, where (c,a) is the read-only environment. #$%&'()*#$%&'()* $%#%&'()*#$%&'()*ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred+$A class of injective functions from a to b, and their projections. * The following law is expected to hold:  project (inject a) == Just a .$Injects a value and lifts it into a . /As 0?, but takes a custom error message to use if projection fails. 0%Projects a value and lifts it into a #, with the possibility of failure. 1Lifted ,. 2Lifted -, the $ fails if the projection fails. 3 Convert a $ over an injected value into a $ over a non-injected value. 4As 5>, but takes a custom error message to use if promotion fails. 5 Promote a $ over a value into a $" over an injection of that value, 9 (failing if that injected value cannot be projected). 6As 7?, but takes a custom error message to use if extraction fails. 7 Convert a # over an injected value into a #" over a projection of that value, 9 (failing if that injected value cannot be projected). 8As 9>, but takes a custom error message to use if promotion fails. 9 Promote a # into over a value into a #" over an injection of that value, 9 (failing if that injected value cannot be projected). .There is an identity injection for all types. +,-./0123456789+,-./0123456789+,-.0/123547968+,-./0123456789ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred:A ;. that shares the same source and target type. ;An undirected $. <Extract the foreward $ from a ;. =Extract the backward $ from a ;. > Construct a ; from two opposite $s. ?Try the :* forewards, then backwards if that fails. ^ Useful when you know which rule you want to apply, but not which direction to apply it in. @3Invert the forewards and backwards directions of a ;. A(Perform the argument translation before either) direction of the bidirectional rewrite. :;<=>?@A:;<=>?@A ;<=:><=?@A:;<=>?@Aghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-InferredBThe B" transformer, in combination with \ and ],  causes a sequence of rewrites to only apply the first success, converting the remainder (and failures) to identity rewrites. CThe C" transformer, in combination with Z and [, ] causes a sequence of rewrites to succeed if at least one succeeds, converting failures to  identity rewrites. D The identity #. EAn always successful $. FExtract the current context. G&Expose the current context and value. HLift a $" to operate on a derived context. IMap a $ over a list. J An identity # with side-effects. KLook at the argument to the $ before choosing which $ to use. L Convert the monadic result of a $! into a result in another monad. MHPerform a collection of rewrites in sequence, requiring all to succeed. NEPerform two rewrites in sequence, succeeding if one or both succeed. OIPerform a collection of rewrites in sequence, succeeding if any succeed. PAs Q&, but takes a custom failure message. QLook at the argument to a #, and choose to be either D or a failure. RA generalisation of Q where the predicate is a $. SCatch a failing #, making it into an identity. TMakes a #Q fail if the result value and the argument value satisfy the equality predicate.  This is a generalisation of U.  changedR = changedByR () U Makes an #5 fail if the result value equals the argument value. V Repeat a #< until it fails, then return the result before the failure. 3 Requires at least the first attempt to succeed. W Attempt each $I until one succeeds, then return that result and discard the rest of the $s. X1An identity translation that resembles a monadic . Y>Fail if the Boolean is False, succeed if the Boolean is True. ZWrap a # using the C monad transformer. [ Unwrap a # from the C monad transformer. \Wrap a # using the B monad transformer. ] Unwrap a # from the B monad transformer. 'BCDEFGHIJKLMNOPQRSTUVWXYZ[\]BCDEFGHIJKLMNOPQRSTUVWXYZ[\]DEFGHKLWIXYSMONVQPRUTJCZ[B\]$BCDEFGHIJKLMNOPQRSTUVWXYZ[\]ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred- BCDEFGHIJKLMNOPQRSTUVWXYZ[\]ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred^,A class for contexts that store the current a., allowing transformations to depend upon it. _ Read the current absolute path. `A d from a local origin. aA d from the root. b2A class of things that can be extended by crumbs.  Typically, c is a context type. # The typical use is to extend an a0 stored in the context (during tree traversal).  Note however, that if an aF is not stored in the context, an instance can still be declared with (c crumb) as an identity operation. cExtend the current a by one crumb. dA d$ is a list stored in reverse order. fA f is just a list. Y The intent is that a path represents a route through the tree from an arbitrary node. g Convert a f to a d . O(n). h Convert a d to a f . O(n). iGet the last crumb from a d . O(1). jLifted version of _. kLifted version of i. The simplest instance of ^ is a itself. Any d can be extended. ^_`abcdefghijk^_`abcdefghijkfdebchgi`a^_kj^_`abcdefghijk ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-InferredlMA context transformer, for augmenting a context with additional information. m;Retrieve the base context (without the extra information). n+Retrieve the extra contextual information. o3Extend a context with some additional information. ;Both components of the context are updated with the crumb. lmnolmnolmnomnlmno ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu>NonepCtrace output of the value being rewritten; use for debugging only. pppp ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred qA q. is a way to focus on a sub-structure of type b from a structure of type a. r Convert a q into a $N that produces a sub-structure (and its context) and an unfocussing function. s The primitive way of building a q. [ If the unfocussing function is applied to the value focussed on then it should succeed, @ and produce the same value as the original argument (of type a). tApply a # at a point specified by a q. uApply a $ at a point specified by a q. vlCheck if the focusing succeeds, and additionally whether unfocussing from an unchanged value would succeed. w The failing q. xA q[ is deemed to have failed (and thus can be caught) if either it fails on the way down, or, { crucially, if it would fail on the way up for an unmodified value. However, actual failure on the way up is not caught 4 (as by then it is too late to use an alternative q)). This means that, in theory, a use of x could cause a succeeding q application to fail.  But provided s. is used correctly, this should never happen. y Construct a q from a ;. z Construct a q from two pure functions. {A q to the injection of a value. |A q to the projection of a value. qrstuvwxyz{| qrstuvwxyz{| qrsrtuzwxvy{| qrstuvwxyz{| ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred0}}C captures the ability to walk over a tree containing nodes of type g,  using a specific context c. Minimal complete definition: ~. %Default definitions are provided for , , , , and , . but they may be overridden for efficiency. ~Apply a #< to all immediate children, succeeding if they all succeed. Apply a $< to all immediate children, succeeding if they all succeed. ! The results are combined in a . Apply a $8 to the first immediate child for which it can succeed. Apply a #6 to all immediate children, suceeding if any succeed. Apply a #8 to the first immediate child for which it can succeed.  Construct a q to the n-th child node. 'List the children of the current node. Apply a $ to a specified child. Apply a # to a specified child. 1Fold a tree in a top-down manner, using a single $ for each node. 2Fold a tree in a bottom-up manner, using a single $ for each node. Apply a $F to the first node for which it can succeed, in a top-down traversal. Apply a $G to the first node for which it can succeed, in a bottom-up traversal. Attempt to apply a $- in a top-down manner, pruning at successes. <An always successful top-down fold, replacing failures with . =An always successful bottom-up fold, replacing failures with . ]An always successful traversal that collects the results of all successful applications of a $ in a list. Like ), but does not traverse below successes. Apply a #7 in a top-down manner, succeeding if they all succeed. Apply a #8 in a bottom-up manner, succeeding if they all succeed. Apply a #J twice, in a top-down and bottom-up way, using one single tree traversal, # succeeding if they all succeed. Apply a #2 in a top-down manner, succeeding if any succeed. Apply a #3 in a bottom-up manner, succeeding if any succeed. Apply a #J twice, in a top-down and bottom-up way, using one single tree traversal,  succeeding if any succeed. Apply a #F to the first node for which it can succeed, in a top-down traversal. Apply a #G to the first node for which it can succeed, in a bottom-up traversal. Attempt to apply a #7 in a top-down manner, pruning at successful rewrites. :A fixed-point traveral, starting with the innermost term.  Construct a q by following a f. Build a q) from the root to a point specified by a `.  Construct a q+ that points to the last node at which the f can be followed. !Repeat as many iterations of the f as possible. Apply a # at a point specified by a f. Apply a $ at a point specified by a f. Apply a # at a point specified by a `. Apply a $ at a point specified by a `. 'Check if it is possible to construct a q( along this path from the current node. Apply a #N to the largest node(s) that satisfy the predicate, requiring all to succeed. Apply a #O to the largest node(s) that satisfy the predicate, succeeding if any succeed. Apply a #b to the first node for which it can succeed among the largest node(s) that satisfy the predicate. Apply a $W to the largest node(s) that satisfy the predicate, combining the results in a monoid. Apply a $b to the first node for which it can succeed among the largest node(s) that satisfy the predicate. OTest if the type of the current node summand matches the type of the argument.  Note that the argument value? is never inspected, it is merely a proxy for a type argument. Wrap a $ using the  monad transformer.  Unwrap a $ from the  monad transformer. Wrap a $ using the  monad transformer.  Unwrap a $ from the  monad transformer. L}~     ,}~,}~B}~     ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred "A context transformer that adds a `) (from the current node) to the context. "Apply a translation that stores a `0 in the context (starting at the current node). Extract the current ` from the context. Return the current `( if the predicate translation succeeds.  Find the `.s to every node that satisfies the predicate.  Find the `Ns to every node that satisfies the predicate, ignoring nodes below successes.  Find the `L to the first node that satisfies the predicate (in a pre-order traversal).  Find the `W to the first descendent node that satisfies the predicate (in a pre-order traversal).  Find the `^ to the node that satisfies the predicate, failing if that does not uniquely identify a node. Build a ` to the node that satisfies the predicate, failing if that does not uniquely identify a node (ignoring nodes below successes).  ghcbeta"Neil Sculthorpe <neil@ittc.ku.edu> Safe-Inferred  !"#$%&'()*+,-./0123456789BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvvwxyz{| } ~     6MTU  }                                    kure-2.12.2Language.KURE.Combinators.ArrowLanguage.KURE.Combinators.MonadLanguage.KURE.MonadCatchLanguage.KURE.TranslateLanguage.KURE.InjectionLanguage.KURE.BiTranslate#Language.KURE.Combinators.TranslateLanguage.KURE.PathLanguage.KURE.ExtendableContextLanguage.KURE.DebugLanguage.KURE.LensLanguage.KURE.WalkerLanguage.KURE.Pathfinder Control.MonadjoinLanguage.KURE.Combinators Language.KUREresultargumenttoFsttoSndswapfork forkFirst forkSecondconstant serialise paralleliseguardMsgguardM guardMsgMifMwhenMunlessMKureM MonadCatchcatchMrunKureM fromKureM liftKureM<+catchesMtryMmtryMattemptMtestMnotM modFailMsg setFailMsg prefixFailMsgwithPatFailMsgliftAndCatchIORewrite Translateapply translaterewrite contextfreeT contextonlyTconstT InjectioninjectprojectinjectMprojectWithFailMsgMprojectMinjectTprojectTextractTpromoteWithFailMsgTpromoteTextractWithFailMsgRextractRpromoteWithFailMsgRpromoteR BiRewrite BiTranslate forewardT backwardT bidirectional whicheverR invertBiT beforeBiROneRAnyRidRsuccessTcontextTexposeT liftContextmapT sideEffectRreaderTresultTandR>+>orRacceptWithFailMsgRacceptR accepterRtryR changedByRchangedRrepeatRcatchesTjoinTguardTwrapAnyR unwrapAnyRwrapOneR unwrapOneRReadPathabsPath LocalPath AbsolutePath ExtendPath@@SnocPathPathpathToSnocPathsnocPathToPath lastCrumbabsPathT lastCrumbT ExtendContext baseContext extraContext extendContextdebugRLenslensTlensfocusRfocusT testLensTfailLcatchLbidirectionalLpureLinjectLprojectLWalkerallRallToneTanyRoneRchildL childrenTchildTchildRfoldtdTfoldbuTonetdTonebuTprunetdTcrushtdTcrushbuTcollectT collectPruneTalltdRallbuRallduRanytdRanybuRanyduRonetdRonebuRprunetdR innermostRpathL localPathL exhaustPathL repeatPathLpathRpathT localPathR localPathT testPathT allLargestR anyLargestR oneLargestR allLargestT oneLargestTsummandIsTypeT WithLocalPathwithLocalPathTexposeLocalPathTacceptLocalPathTpathsToT prunePathsToT onePathToToneNonEmptyPathToT uniquePathToTuniquePrunePathToTbaseControl.CategoryCategoryGHC.Basefail Data.EitherEitherStringGHC.ErrerrorMonad Data.Monoidmemptyghc-prim GHC.TypesIO$fMonadCatchIOGHC.ShowshowSuccessFailure$fApplicativeKureM$fFunctorKureM$fMonadCatchKureM $fMonadKureM$fMonoidTranslate$fArrowApplyTranslate Control.ArrowKleisliArrow$fArrowPlusTranslate$fArrowZeroTranslate$fArrowTranslate$fCategoryTranslate$fMonadIOTranslate$fMonadPlusTranslate$fMonadCatchTranslate$fMonadTranslate$fAlternativeTranslate$fApplicativeTranslate$fFunctorTranslate $fInjectionaaprojectWithFailMsgT$fInjectionaMaybe$fCategoryBiTranslate GHC.Classes==PBoolcheckSuccessPBoolunAnyRunOneR$fMonadCatchOneR $fMonadOneR$fMonadCatchAnyR $fMonadAnyR$fReadPathSnocPathcrumb$fExtendPathSnocPathcrumbsafehead$fShowSnocPath$fMonoidSnocPath$fExtendPathExtendContextcrumb$fCategoryLensMonoidwrapAllTAllT unwrapAllTwrapOneTOneT unwrapOneTSetChildGetChildPtryLpSndcheckSuccessPMaybeunAllTunOneTgetChildSecond wrapGetChildunwrapGetChildgetChild wrapSetChildunwrapSetChildsetChildchildL_default$fMonadCatchGetChild$fMonadGetChild$fMonadCatchOneT $fMonadOneT$fMonadCatchAllT $fMonadAllTrequireUniquePath