!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { |}~#(c) 2008--2009 Universiteit UtrechtBSD3generics@haskell.org experimental non-portable Safe-Inferred!"2346<=HJKMnIt is in general not necessary to use the generic navigation functions directly. The functions listed in the `` Interface''' section below are more user-friendly.WAbstract type of context frames. Not required for the high-level navigation functions. Abstract type of locations. A location contains the current focus and its context. A location is parameterized over the family of datatypes and over the type of the complete value. mStart navigating a datastructure. Returns a location that focuses the entire value and has an empty context._Operate on the current focus. This function can be used to extract the current point of focus.3Update the current focus without changing its type.+        Safe-Inferred!"HM  A navigation step in a fixpoint.A location within a fixpoint.)Move down to the leftmost child. Returns ! if the current focus is a leaf.*Move down to the rightmost child. Returns ! if the current focus is a leaf.Move up to the parent. Returns # if the current focus is the root.#Move to the right sibling. Returns 0 if the current focus is the rightmost sibling."Move to the left sibling. Returns / if the current focus is the leftmost sibling.>Move through all positions in depth-first left-to-right order.>Move through all positions in depth-first right-to-left order.:Return the entire value, independent of the current focus.     Safe-Inferred:Given a witness, convert the value of that type to String. Safe-Inferred!"HM$A value of some type in data family s wrapped in an f, together with its witness.$A value of some type in data family s, together with its witness. Helper constructor.! Unify an  with an a."Helper constructor.# Unify an  with an f a.$ Unwrap an  and pass it to a function.%#Removes the value from its functor f.  !"#$%  !"#$%  !"#%$  !"#$% Safe-Inferred&6Captures hints for the exploration of annotated trees.("Whether the current focus matches.) Whether to explore the children.*(Whether to explore further to the right.&'()*&'()*&'()*&'()* Safe-Inferred !"3=HJKM ,A fixpoint of a data family s annotated with an xL at every recursive position, with existentially quantified top-level index.-(A functor with fully annotated children..A fully annotated tree./2Supply a tree with an annotation at the top level.0>Removes all annotations from a recursively annotated fixpoint.14Collects the direct children of a functor in a list.2OFlatten an annotated tree to a list of subtrees coupled with their annotations.3:Yield all subtrees whose annotation matches the predicate.4;Flatten an annotated tree and print all subtrees to stdout.5:Recursively yield all annotations in the tree in preorder.6,Extract the annotation of the current focus.7Explore an annotated tree. Starting with the root of the tree, at each position the annotation at that position is matched against the &) predicates and all the selections where (# was positive are collected. The * and )I allow pruning of the tree, preventing entire parts from being visited.8LFind the deepest node in an annotated tree that matches the predicate. Starting with the root, the predicate tells whether a node's annotation matches. If so, the search continues at the node's children and the node's siblings to the right are excluded from further exploration. If no child matches, the node itself is returned.+,-./012345678+,-./012345678.-/,012345+678+,-./012345678None !"3=BK9Yield over the identity monad.:@The Yield transformer. Allows yielding generic values in family fam with annotations of type x.;8Monads that allow yielding recursively annotated values.<2Yielded values have types in this datatype family.=The type of the annotation.>#Yields a value with its annotation.9:;<=>?@AB 9:;<=>?@AB ;<=>:9BA@? 9:;<=>?@AB Safe-InferredCExcept is like Eithers but is meant to be used only in applicative computations. When two exceptions are sequenced, their sum (using ) is computed.CDEFGCDECEDGFCEDFG  Safe-Inferred*3HMH!Algebras for error catamorphisms.ICoalgebras for anamorphisms.JAlgebras for catamorphisms.KFixpoint of functors.N3Reduces a tree to a value according to the algebra.O:Constructs a tree from a value according to the coalgebra.P3Apply a transformation to a tree's direct children.QQReduces a tree to a value according to the algebra, propagating potential errors. HIJKLMNOPQ HIJKLMNOPQ KLMPJNIOHQ HIJKLMNOPQ  Safe-InferredHM RCaptures navigation steps in a U. Its ' instance specifies the identity step () and step composition ().UjA quasi-zipper, meant for O(1), fixed-memory stepping through a tree structure, but not meant for updates.W!The current focus of this zipper.XMove up to the parent.YMove to the left sibling.ZMove to the right sibling.["Move down into the leftmost child.\Move into the root of the fixed point. The returned zipper builds a data structure with optimal sharing and fixed memory usage. For example, zLeft >=> zRight4 (if successful) returns to the same node in memory.]KWalk back up to the root of the fixed point and leave the zipper structure.^ Move down into a specific child._FTraverses the tree in preorder, yielding all possible tree selections.RSTUVWXYZ[\]^_RSTUVWXYZ[\]^_UVWXYZ[\]^_RST RSTUVWXYZ[\]^_  Safe-Inferred `(A functor with fully annotated children.aA fully annotated tree.bLifted annotation of functors.d2Supply a tree with an annotation at the top level.e.Yields the annotation at the root of the tree.f Recursively discard annotations.gReduces a tree to a value according to the algebra, collecting potential errors. The errors are combined with the annotations in the tree at the positions at which the errors occurred.hExplore an annotated tree. Starting with the root of the tree, at each position the annotation at that position is matched against the &) predicates and all the selections where (# was positive are collected. The * and )I allow pruning of the tree, preventing entire parts from being visited.iLFind the deepest node in an annotated tree that matches the predicate. Starting with the root, the predicate tells whether a node's annotation matches. If so, the search continues at the node's children and the node's siblings to the right are excluded from further exploration. If no child matches, the node itself is returned.`abcdefghi `abcdefghi bcae`dfghi `abcdefghi  Safe-Inferred !"24=HJKMjVConverts convenient algebras to algebras that are able to work with pattern functors.lGType family that converts pattern functors to convenient algebra types.m'An error algebra over pattern functors.nReduces a tree to a value according to the algebra, collecting potential errors. The errors are combined with the annotations in the tree at the positions at which the errors occurred.oFor constructing algebras that are made of nested pairs rather than n-ary tuples, it is helpful to use this pairing combinator.jklmnojklmnolmjknojklmnoo  Safe-Inferred pA structural selection expressed as a textual selection. The margins indicate the whitespace directly around the selected structure.tbA simple textual selection: starting offset and ending offset, respectively. Offsets are 0-based.uA BoundsL' inner range does not include the whitespace around the selected structure.vA BoundsD' outer range includes the whitespace around the selected structure.w6Tells whether the offset falls within the given range.x>Tells whether the first range is enclosed by the second range.yA range is within certain bounds if its left offset is within the bounds' left margin and its right offset is within the bounds' right margin.zrangesInBounds b yields all those ranges r for which rangeInBounds r b.{3A measure for the dissimilarity between two ranges. 3distRange (l1, r1) (l2, r2) = |l1 - l2| + |r1 - r2| pqrstuvwxyz{ pqrstuvwxyz{ tpqrsuvwxyz{ pqrstuvwxyz{ Safe-Inferred|A parser that works on symbols coupled with token information. The state maintains the current position in the stream. This position is the range of whitespace between two tokens.}=Symbols form input for parsers. Minimal complete definition: ~.~.Unparses a symbol, converting it back to text.7Yields the size of a symbol. Default implementation is length . unparse.Given a predicate that tells what tokens to discard, keeps only the meaningful tokens and couples them with position information.(Yield the current position in the input.(Recognise a symbol matching a predicate.Recognise a specific symbol. |}~|}~}~||}~ Safe-Inferred>Find the deepest node whose bounds match the given range. See y.>Find the deepest node whose bounds contain the given position.Find all selections in the tree and return their bounds. The tree is traversed in preorder. Consequently, the bounds are returned in lexicographical order.repairBy cost tree range/ finds the the closest valid text selection to range, where  ''closest''. is determined by the specified cost function. Defined as  {.'Move around in a tree according to the R+, expressed in tree selections. Although a t is required as input, a ps is returned, providing information about all the valid text selections that would select the particular tree node. Safe-InferredGiven the left margin of a structure, asks the parser for the right margin and wraps the position information around the root of the tree.FWrap an unnotated tree with position information from the parse state.!Parse right-recursive structures. Parse left-recursive structures.None34A parser that yields its components, annotated with p.FWrap an unnotated tree with position information from the parse state.Given the left margin of a structure, asks the parser for the right margin and wraps the position information around the root of the tree.!Parse right-recursive structures. Parse left-recursive structures. Safe-Inferred3HJKM>Find the deepest node whose bounds match the given range. See y. Defined as  {.'Move around in a tree according to the +, expressed in tree selections. Although a t is required as input, a ps is returned, providing information about all the valid text selections that would select the particular tree node. !"#$%&'()*+,-..//01234566789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV W X Y Z [ \ ] ^ _ ` " " a   b c d e f  + g h < = i i > j ? k F G l m n o k p q q r s t u v w x y z {|}~I      Annotations-0.2.1Annotations.MultiRec.ZipperAnnotations.MultiRec.ZipperFixAnnotations.MultiRec.ShowFamAnnotations.MultiRec.AnyAnnotations.ExploreHintsAnnotations.MultiRec.AnnotatedAnnotations.MultiRec.YieldAnnotations.ExceptAnnotations.F.FixpointsAnnotations.F.ZipperAnnotations.F.AnnotatedAnnotations.MultiRec.ErrorAlgAnnotations.BoundsAnnotations.BoundsParserAnnotations.F.PositionalAnnotations.F.ParserCombinators&Annotations.MultiRec.ParserCombinatorsAnnotations.MultiRec.PositionalZippercmapAfillfirstlastnextprevCtxCtxsPushEmptyLocenteronupdateNav FixZipperdowndown'uprightleftdfnextdfprevleaveShowFamshowFamAnyFAnymkAnymatchAnymkAnyF matchAnyF$? unwrapAnyF ExploreHints matchHere exploreDown exploreRight AnnZipper AnyAnnFixAnnFix1AnnFixmkAnnFix unannotatechildrenflatten filterAnnFix debugFlattenallAnnotationsfocusAnnexplorefindLeftmostDeepestYieldYieldT MonadYieldYieldFamAnnTypeyield runYieldTG runYieldT runYieldGrunYieldExceptOKFailed$fApplicativeExcept$fFunctorExcept ErrorAlgebra CoalgebraAlgebraFixInoutcataanacomposcascadenavzFocuszUpzLeftzRightzDownchildallFociAnnrootAnn errorCata MkErrorAlg mkErrorAlgErrorAlg ErrorAlg_PF&Bounds leftMargin rightMarginRange innerRange outerRange posInRange rangeInRange rangeInBoundsrangesInBounds distRangePSymbolunparse symbolSizecollapsegetPossatisfypToken selectByRange selectByPos validBoundsrepairByrepair moveSelection mkBoundedunitchainrchainlYPsortOnCCCTagCIdC2C1CRCL impossiblecastIdcastTag $fZipperphiC$fZipperphi:>:$fZipperphi:*:$fZipperphi:+: $fZipperphiU $fZipperphiK $fZipperphiI$fHFunctorphiLoc$fHFunctorphiCtxs$fHFunctorphiCtxTFCo:R:CtxCbrixTFCo:R:Ctx:>:brixTFCo:R:CtxIbrixTFCo:R:Ctx:*:brixTFCo:R:Ctx:+:brixTFCo:R:CtxUbrixTFCo:R:CtxKbrixbase Data.MaybeNothingdfshowAny $fShowAnysnd'explore'doYield distribute$fMonadYieldYieldT$fMonadTransYieldT Data.MonoidmappendmapFixMonoidmemptyenter'allFoci' $fMonoidNav$fTraversableAnn $fFoldableAnn $fFunctorAnn$fMkErrorAlg:+:$fMkErrorAlg:>:$fMkErrorAlg:*:$fMkErrorAlg:*:0 $fMkErrorAlgUTFCo:R:ErrorAlg:>:eaTFCo:R:ErrorAlg:+:eaTFCo:R:ErrorAlg:*:eaTFCo:R:ErrorAlg:*:ea0TFCo:R:ErrorAlgUea collapse' $fSymbol[]