C4      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ~  '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred 0Apply a pure function to the result of an arrow.2Apply a pure function to the argument to an arrow.MApply an arrow to the first element of a pair, discarding the second element.MApply an arrow to the second element of a pair, discarding the first element./A 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. TApply a collection of arrows to the same input, combining their results in a monoid.     '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc 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.JIf the monadic predicate holds then perform the monadic action, else fail.JIf the monadic predicate holds then fail, else perform the monadic action.    '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)5 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 X) A major advantage of this is that monadic pattern match failures are caught safely.s with a catch for -. The following laws are expected to hold: <fail msg `catchM` f == f msg return a `catchM` f == return a$Catch a failing monadic computation.Eliminator for .Get the value from a 0, providing a function to handle the error case.Lift a  computation to any other monad./A monadic catch that ignores the error message.NSelect the first monadic computation that succeeds, discarding any thereafter.MCatch a failing monadic computation, making it succeed with a constant value.<Catch a failing monadic computation, making it succeed with .MCatch 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.eModify the error message of a failing monadic computation. Successful computations are unaffected.bSet the error message of a failing monadic computation. Successful computations are unaffected. nAdd a prefix to the error message of a failing monadic computation. Successful computations are unaffected.!LUse 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. !" !"" ! !"'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)#=A transformation that shares the same source and target type.$A deprecated synonym for %.%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.&2Apply a transformation to a value and its context.'/The primitive way of building a transformation.(A deprecated synonym for '.)(The primitive way of building a rewrite.*+Apply a rewrite to a value and its context.+A deprecated synonym for &.,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./Build a %* that doesn't perform any monadic effects.Lifting through the D 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.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.OLifting through a Reader transformer, where (c,a) is the read-only environment.#$%&'()*+,-./ #$%&'()*+,-./%&$#&*+'(),-./#$%&'()*+,-./'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)2460$A class of injective functions from a to bB, and their projections. The following law is expected to hold: project (inject a) == Just a3$Injects a value and lifts it into a .4As 5>, but takes a custom error message to use if projection fails.5%Projects a value and lifts it into a ", with the possibility of failure.6Lifted 1.8Lifted 23, the transformation fails if the projection fails.9`Convert a transformation over an injected value into a transformation over a non-injected value.:As ;=, but takes a custom error message to use if promotion fails.;Promote a transformation over a value into a transformation over an injection of that value, (failing if that injected value cannot be projected).<As =>, but takes a custom error message to use if extraction fails.=Convert a rewrite over an injected value into a rewrite over a projection of that value, (failing if that injected value cannot be projected).>As ?=, but takes a custom error message to use if promotion fails.?Promote a rewrite over a value into a rewrite over an injection of that value, (failing if that injected value cannot be projected).-There is an identity injection for all types.0123456789:;<=>?0123456789:;<=>?012354689;7:=?<>0123456789:;<=>?'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)@A B- that shares the same source and target type.AA deprecated synonym for A.BAn undirected %.CExtract the forward % from a B.DExtract the backward % from a B.E Construct a B from two opposite %s.FTry the @ forwards, then backwards if that fails. Useful when you know which rule you want to apply, but not which direction to apply it in.G2Invert the forwards and backwards directions of a B.H+Perform the argument transformation before either( direction of the bidirectional rewrite.I,Apply the argument rewrite to the result of either( direction of the bidirectional rewrite.JAs K>, but takes a custom error message to use if extraction fails.KConvert a bidirectional transformation over an injected value into a bidirectional transformation over non-injected values, (failing if an injected value cannot be projected).LAs M=, but takes a custom error message to use if promotion fails.MPromote a bidirectional transformation from value to value into a transformation over an injection of those values, (failing if an injected value cannot be projected).NAs O>, but takes a custom error message to use if extraction fails.OConvert a bidirectional rewrite over an injected value into a bidirectional rewrite over a projection of that value, (failing if an injected value cannot be projected).PAs Q=, but takes a custom error message to use if promotion fails.QPromote a bidirectional rewrite over a value into a bidirectional rewrite over an injection of that value, (failing if an injected value cannot be projected).@ABCDEFGHIJKLMNOPQ@ABCDEFGHIJKLMNOPQBCDA@ECDFGHIKMOQJLNP@ABCDEFGHIJKLMNOPQ'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)RThe R" transformer, in combination with l and m, causes a sequence of rewrites to only apply the first success, converting the remainder (and failures) to identity rewrites.SThe S" transformer, in combination with j and kt, causes a sequence of rewrites to succeed if at least one succeeds, converting failures to identity rewrites.TThe identity rewrite.U$An always successful transformation.VExtract the current context.W%Expose the current context and value.X6Lift a transformation to operate on a derived context.Y!Map a transformation over a list.Z&An identity rewrite with side-effects.[ALook at the argument to the transformation before choosing which % to use.\NConvert the monadic result of a transformation into a result in another monad.]GPerform a collection of rewrites in sequence, requiring all to succeed.^DPerform two rewrites in sequence, succeeding if one or both succeed._HPerform a collection of rewrites in sequence, succeeding if any succeed.`As a%, but takes a custom failure message.a;Look at the argument to a rewrite, and choose to be either T or a failure.bA generalisation of a where the predicate is a %.c4Catch a failing rewrite, making it into an identity.dMakes a rewrite fail if the result value and the argument value satisfy the equality predicate. This is a generalisation of e. changedR = changedByR ()eDMakes an rewrite fail if the result value equals the argument value.f~Repeat a rewrite until it fails, then return the result before the failure. Requires at least the first attempt to succeed.guAttempt each trransformation until one succeeds, then return that result and discard the rest of the transformations.h4An identity transformation that resembles a monadic .i=Fail if the Boolean is False, succeed if the Boolean is True.jWrap a # using the S monad transformer.k Unwrap a # from the S monad transformer.lWrap a # using the R monad transformer.m Unwrap a # from the R monad transformer.,RSTUVWXYZ[\]^_`abcdefghijklmRSTUVWXYZ[\]^_`abcdefghijklmTUVWX[\gYhic]_^fa`bedZSjkRlm)RSTUVWXYZ[\]^_`abcdefghijklm'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred- RSTUVWXYZ[\]^_`abcdefghijklm'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)2468n,A class for contexts that store the current q-, allowing transformations to depend upon it.oRead the current absolute path.pA t from a local origin.qA t from the root.r@A class of things that can be extended by crumbs. Typically, c7 is a context type. The typical use is to extend an qL stored in the context (during tree traversal). Note however, that if an qF is not stored in the context, an instance can still be declared with ('' crumb) as an identity operation.sExtend the current q by one crumb.tA t# is a list stored in reverse order.vA vi is just a list. The intent is that a path represents a route through the tree from an arbitrary node.w Convert a v to a t. O(n).x Convert a t to a v. O(n).zGet the last crumb from a t. O(1).{Lifted version of o.|Lifted version of z.The simplest instance of n is q itself.Any t can be extended.nopqrstuvwxyz{|nopqrstuvwxyz{|vtursxwyzpqno|{nopqrstuvwxyz{| '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred)246}LA context transformer, for augmenting a context with additional information.~:Retrieve the base context (without the extra information).*Retrieve the extra contextual information.2Extend a context with some additional information.:Both components of the context are updated with the crumb.}~}~}~~}~ '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghcNoneBTrace output of the value being rewritten; use for debugging only. '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghc Safe-Inferred) A . is a way to focus on a sub-structure of type b from a structure of type a. Convert a  into a %M that produces a sub-structure (and its context) and an unfocussing function. The primitive way of building a . 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).*Apply a rewrite at a point specified by a .1Apply a transformation at a point specified by a .kCheck if the focusing succeeds, and additionally whether unfocussing from an unchanged value would succeed. The failing .A  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 (as by then it is too late to use an alternative )). This means that, in theory, a use of  could cause a succeeding & application to fail. But provided - is used correctly, this should never happen. Construct a  from a B. Construct a  from two pure functions.A  to the injection of a value.A  to the projection of a value.  '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghcNone)36M0C captures the ability to walk over a tree containing nodes of type u, using a specific context c.Minimal complete definition: .%Default definitions are provided for , , , , and /, but they may be overridden for efficiency.JApply a rewrite to all immediate children, succeeding if they all succeed.sApply a transformation to all immediate children, succeeding if they all succeed. The results are combined in a .MApply a transformation to the first immediate child for which it can succeed.DApply a rewrite to all immediate children, suceeding if any succeed.FApply a rewrite to the first immediate child for which it can succeed. Construct a  to the n-th child node.&List the children of the current node.,Apply a transformation to a specified child.%Apply a rewrite 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 transformation to the first node for which it can succeed, in a top-down traversal.\Apply a transformation 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.EApply a rewrite in a top-down manner, succeeding if they all succeed.FApply a rewrite in a bottom-up manner, succeeding if they all succeed.{Apply a rewrite twice, in a top-down and bottom-up way, using one single tree traversal, succeeding if they all succeed.@Apply a rewrite in a top-down manner, succeeding if any succeed.AApply a rewrite in a bottom-up manner, succeeding if any succeed.vApply a rewrite twice, in a top-down and bottom-up way, using one single tree traversal, succeeding if any succeed.TApply a rewrite to the first node for which it can succeed, in a top-down traversal.UApply a rewrite to the first node for which it can succeed, in a bottom-up traversal.Attempt to apply a #6 in a top-down manner, pruning at successful rewrites.9A fixed-point traveral, starting with the innermost term. Construct a  by following a v.Build a ) from the root to a point specified by a p. Construct a + that points to the last node at which the v can be followed.!Repeat as many iterations of the v as possible.*Apply a rewrite at a point specified by a v.1Apply a transformation at a point specified by a v.*Apply a rewrite at a point specified by a p.1Apply a transformation at a point specified by a p.'Check if it is possible to construct a ' along this path from the current node.\Apply a rewrite to the largest node(s) that satisfy the predicate, requiring all to succeed.]Apply a rewrite to the largest node(s) that satisfy the predicate, succeeding if any succeed.pApply a rewrite to the first node for which it can succeed among the largest node(s) that satisfy the predicate.lApply a transformation to the largest node(s) that satisfy the predicate, combining the results in a monoid.wApply a transformation to the first node for which it can succeed among the largest node(s) that satisfy the predicate.iTest 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.R      !"#$%&'(),,H      !"#$%&'() '(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghcNone3M "A context transformer that adds a p( (from the current node) to the context.%Apply a transformation that stores a p/ in the context (starting at the current node).Extract the current p from the context.Return the current p* if the predicate transformation succeeds. Find the p-s to every node that satisfies the predicate. Find the pMs to every node that satisfies the predicate, ignoring nodes below successes. Find the pK to the first node that satisfies the predicate (in a pre-order traversal). Find the pV to the first descendent node that satisfies the predicate (in a pre-order traversal). Find the p] to the node that satisfies the predicate, failing if that does not uniquely identify a node.Build a p~ to the node that satisfies the predicate, failing if that does not uniquely identify a node (ignoring nodes below successes). * *'(c) 2012--2014 The University of KansasBSD3"Neil Sculthorpe <neil@ittc.ku.edu>betaghcNone  !"#$%&'()*+,-./0123456789:;<=>?RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|+ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     7Tde                     ! ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ;< kure-2.16.10Language.KURE.Combinators.ArrowLanguage.KURE.Combinators.MonadLanguage.KURE.MonadCatchLanguage.KURE.TransformLanguage.KURE.InjectionLanguage.KURE.BiTransform#Language.KURE.Combinators.TransformLanguage.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 Translate TransformapplyT transform translaterewriteapplyRapply contextfreeT contextonlyTconstT effectfreeT InjectioninjectprojectinjectMprojectWithFailMsgMprojectMinjectTprojectWithFailMsgTprojectTextractTpromoteWithFailMsgTpromoteTextractWithFailMsgRextractRpromoteWithFailMsgRpromoteR BiRewrite BiTranslate BiTransformforwardT backwardT bidirectional whicheverR invertBiT beforeBiRafterBiRextractWithFailMsgBiT extractBiTpromoteWithFailMsgBiT promoteBiTextractWithFailMsgBiR extractBiRpromoteWithFailMsgBiR promoteBiROneRAnyRidRsuccessTcontextTexposeT liftContextmapT sideEffectRreaderTresultTandR>+>orRacceptWithFailMsgRacceptR accepterRtryR changedByRchangedRrepeatRcatchesTjoinTguardTwrapAnyR unwrapAnyRwrapOneR unwrapOneRReadPathabsPath LocalPath AbsolutePath ExtendPath@@SnocPathPathpathToSnocPathsnocPathToPathsingletonSnocPath 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$fMonoidTransform$fArrowApplyTransform Control.ArrowKleisliArrow$fArrowPlusTransform$fArrowZeroTransform$fArrowTransform$fCategory*Transform$fMonadIOTransform$fMonadPlusTransform$fMonadCatchTransform$fMonadTransform$fAlternativeTransform$fApplicativeTransform$fFunctorTransform $fInjectionaa$fInjectionaMaybe$fCategory*BiTransform GHC.Classes==PBoolcheckSuccessPBoolunAnyRunOneR$fMonadCatchOneR $fMonadOneR$fApplicativeOneR $fFunctorOneR$fMonadCatchAnyR $fMonadAnyR$fApplicativeAnyR $fFunctorAnyR$fFunctorPBool$fReadPathSnocPathcrumb$fExtendPathSnocPathcrumbsafehead$fShowSnocPath$fFunctorSnocPath$fMonoidSnocPath$fExtendPathExtendContextcrumb$fCategory*LensMonoidwrapAllTAllT unwrapAllTwrapOneTOneT unwrapOneTSetChildGetChildPtryLpSndcheckSuccessPMaybeunAllTunOneTgetChildSecond wrapGetChildunwrapGetChildgetChild wrapSetChildunwrapSetChildsetChildchildL_default$fMonadCatchGetChild$fMonadGetChild$fApplicativeGetChild$fFunctorGetChild$fMonadCatchOneT $fMonadOneT$fApplicativeOneT $fFunctorOneT$fMonadCatchAllT $fMonadAllT$fApplicativeAllT $fFunctorAllTrequireUniquePath