!\`      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ 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 [ \ ] ^ _ Safe6`abcdefghijklmnopqrstuvwxyz{|}~Safe6fixplateCategorial dual of . Equivalent to the free monad.fixplateA newtype wrapper around Attr f a so that we can make Attr f an instance of Functor, Foldable and Traversable (and Comonad). This is necessary since Haskell does not allow partial application of type synonyms."Equivalent to the co-free comonad.$fixplated"Functorised" versions of standard type classes. If you have your a structure functor, for example lExpr e = Kst Int | Var String | Add e e deriving (Eq,Ord,Read,Show,Functor,Foldable,Traversable)Hyou should make it an instance of these, so that the fixed-point type Mu Expr can be an instance of Eq, Ord and Show. Doing so is very easy: instance EqF Expr where equalF = (==) instance OrdF Expr where compareF = compare instance ShowF Expr where showsPrecF = showsPrecThe ReadO instance depends on whether we are using GHC or not. The Haskell98 version is 0instance ReadF Expr where readsPrecF = readsPrecwhile the GHC version is /instance ReadF Expr where readPrecF = readPrec&fixplatedThis a data type defined to be a place-holder for childs. It is used in tree drawing, hashing, and Shape.+It is deliberately not made an instance of U, so that you can choose your preferred style. For example, an acceptable choice is %instance Show Hole where show _ = "_"(fixplateCategorical dual of ,. Equivalent to Free f a)fixplateCategorical dual of -.,fixplate*Annotated fixed-point type. Equivalent to  CoFree f a-fixplateType of annotations/fixplatethe annotation0fixplatethe original functor1fixplateThe fixed-point type.4fixplate.We call a tree "atomic" if it has no subtrees.5fixplate/Lifting natural transformations to annotations.6fixplate/Lifting natural transformations to annotations.7fixplateThe attribute of the root node.8fixplate@A function forgetting all the attributes from an annotated tree.Bfixplate NOTE: The $O instance for annotations compares both the annotations and the original part. Efixplate NOTE: The "- instance for annotations first compares the  annotations, and then the functor part. If this is not the desired behaviour (it's not clear to me at the moment what is the good default here), you can use the standard newtype trick to define a new behaviour.# !"#$%&'()*+,-.0/123456789:#1234-.0/,5)*+(678&'$%"# !9:SafeK ^fixplateA  catamorphism9 is the generalization of right fold from lists to trees._fixplateA  paramorphism/ is a more general version of the catamorphism.`fixplateAnother version of _$ (a bit less natural in some sense).afixplateA list version of _ (compare with Uniplate)bfixplateAn  anamorphism? is simply an unfold. Probably not very useful in this context.cfixplateAn  apomorphism( is a generalization of the anamorphism.dfixplateA  hylomorphism9 is the composition of a catamorphism and an anamorphism.efixplateA  zygomorphism is a basically a catamorphism inside another catamorphism. It could be implemented (somewhat wastefully) by first annotating each subtree with the corresponding values of the inner catamorphism ( synthCata7), then running a paramorphims on the annotated tree: rzygo_ g h == para u . synthCata g where u = h . fmap (first attribute) . unAnn first f (x,y) = (f x, y)gfixplateHHistomorphism. This is a kind of glorified cata/paramorphism, after all: _cata f == histo (f . fmap attribute) para f == histo (f . fmap (\t -> (forget t, attribute t)))hfixplate0Futumorphism. This is a more interesting unfold.ifixplateMonadic catamorphism.kfixplateMonadic paramorphism.mfixplateAnother version of k.^_`abcdefghijklm^_`abcdefghijklmSafe`i nfixplateA type encoding the "shape" of the functor data: We ignore all the fields whose type is the parameter type, but remember the rest: -newtype Shape f = Shape { unShape :: f Hole }CThis can be used to decide whether two realizations are compatible.ofixplateEquivalent to reverse . toList.rfixplateIThe children together with functions replacing that particular child. tfixplate/Apply the given function to each child in turn.ufixplateBuilds up a structure from a list of the children. It is unsafe in the sense that it will throw an exception if there are not enough elements in the list.vfixplateExtracts the ith child.xfixplate2Number of children. This is the generalization of  to foldable functors: sizeF x = length (toList x)yfixplateEnumerates children from the left to the right, starting with zero. Also returns the number of children. This is just a simple application of .|fixplate%Extracting the "shape" of the functor}fixplate+Zips two structures if they are compatible.fixplate(Zipping two structures using a function.fixplateUnsafe version of : does not check if the two structures are compatible. It is left-biased in the sense that the structure of the second argument is retained.fixplateMonadic version of . TODO: better name?&'nopqrstuvwxyz{|}~opqrstuvwxyz{&'n|}~SafemfixplateMap over annotations %annMap f = unAttrib . fmap f . Attribfixplate SynthetisedD attributes are created in a bottom-up manner. As an example, the sizes. function computes the sizes of all subtrees: [sizes :: (Functor f, Foldable f) => Mu f -> Attr f Int sizes = synthetise (\t -> 1 + sum t) (note that sum here is 7Data.Foldable.sum == Prelude.sum . Data.Foldable.toList) See also .fixplateGeneralization of scanr for trees. See also .fixplateList version of  (compare with Uniplate)fixplateMonadic version of .fixplate Synonym for , motivated by the equation " attribute . synthCata f == cata fVThat is, it attributes all subtrees with the result of the corresponding catamorphism.fixplate Synonym for ,. Note that this could be a special case of : GscanCata f == annZipWith (flip const) . synthCata (\(Ann a x) -> f a x) Catamorphim (cata) is the generalization of foldr from lists to trees;  is one generalization of scanr, and  is another generalization.fixplateJAttributes all subtrees with the result of the corresponding paramorphism. " attribute . synthPara f == para ffixplateAnother version of . $ attribute . synthPara' f == para' ffixplateSynthetising zygomorphism. 'attribute . synthZygo_ g h == zygo_ g hfixplate.Accumulating catamorphisms. Generalization of  from lists to trees.fixplateAccumulating paramorphisms. fixplateCould be a special case of : |mapAccumCata f == second (annZipWith (flip const)) . synthAccumCata (\(Ann b t) -> f b t) where second g (x,y) = (x, g y)fixplate Synonym for $. If you don't need the result, use cataM_ instead.fixplateMonadic version of %. If you don't need the result, use paraM_ instead.fixplateMonadic version of . fixplate InheritedC attributes are created in a top-down manner. As an example, the depths^ function computes the depth (the distance from the root, incremented by 1) of all subtrees: Jdepths :: Functor f => Mu f -> Attr f Int depths = inherit (\_ i -> i+1) 0fixplateGeneralization of . TODO: better name?fixplateGeneralization of scanl from lists to trees.fixplateMonadic version of .fixplateWMonadic top-down "sweep" of a tree. It's kind of a more complicated folding version of p. This is unsafe in the sense that the user is responsible to retain the shape of the node. TODO: better name?fixplateAn attributed version of . Probably more useful.fixplateiSynthetising attributes via an accumulating map in a left-to-right fashion (the order is the same as in foldl).fixplateiSynthetising attributes via an accumulating map in a right-to-left fashion (the order is the same as in foldr).fixplateWe use  to number the nodes from 0 to (n-1)0 in a left-to-right traversal fashion, where n == length (universe tree)9 is the number of substructures, which is also returned.fixplate[Bottom-up transformations which automatically resynthetise attributes in case of changes.fixplateBottom-up transformations to normal form (applying transformation exhaustively) which automatically resynthetise attributes in case of changes.fixplate3Merges two layers of annotations into a single one.fixplate5Merges three layers of annotations into a single one.++Safe fixplateThe list of direct descendants.fixplateThe list of all substructures. Together with list-comprehension syntax this is a powerful query tool. For example the following is how you get the list of all variable names in an expression: 5variables expr = [ s | Fix (Var s) <- universe expr ]fixplateBottom-up transformation.fixplateNTop-down transformation. This provided only for completeness; usually, it is  what you want use instead.fixplate>Non-recursive top-down transformation. This is basically just .fixplate"Similarly, this is basically just .fixplate8Bottom-up transformation until a normal form is reached.fixplateBottom-up transformation (typically "shallow", that is, restricted to a single level) which can change the structure functor (actually  is a special case of this).fixplateWe annotateM the nodes of the tree with functions which replace that particular subtree.fixplateFlattened version of .fixplate(Strict) left fold. Since Mu fJ is not a functor, but a data type, we cannot make it an instance of the Foldable type class.Safefixplate&Prints a tree. It is defined simply as drawTree = putStrLn . showTreefixplate:Creates a string representation which can be printed with .fixplateGenerate a graphviz .dot file Safei    !"#$%&'()+*,-./0123456789:^_`abcdefghijklm   Safe9fixplate;A class encoding fixity and rendering of nodes if the tree.Minimum complete definition: , and  or X. Unless you want some type of rendering not directly supported, you shouldn't specify .fixplatefixity of the nodefixplatea string representing the node without the childrenfixplateHfull rendering of the node. You can redefine this for custom renderings.fixplate>Fixities. TODO: separate non-fixity stuff like style and wordsfixplateeg. variable; precedence will be 666fixplateeg. (Node arg1 arg2 arg3) or node[arg1,arg2,arg3].fixplateeg. ~arg; the Int is the precendencefixplateeg. x+yfixplateeg. arg++fixplateeg. if ... then ... else ...  or let ... in .... With precedence 0?fixplatefor your custom renderingfixplateMixfix style. Example: \[ Keyword "if" , Placeholder , keyword "then" , Placeholder , keyword "else" , Placeholder ]fixplateApplication style fixplateeg. (Node arg1 arg2 arg3); precedence will be app_prec == 10fixplateeg. node[arg1,arg2,arg3]C; precedence will be 11, but child environment precedence will be 0fixplateA separator, eg. "," or " | ".fixplate!A pair of matching brackets, eg. Bracket "(" ")" or Bracket "[|" "|]".fixplate AssociativityfixplateRender the expression Safe fixplate@A concrete hash implementation. We don't use type classes since 2a hash type class does not belong to this library;1we don't want to restrict the user's design space0Thus we simulate type classes with record types.fixplate"the hash of an empty byte sequencefixplatedigest a (unicode) characterfixplatedigest a hash value fixplateA tree annotated with hashes of all subtrees. This gives us fast inequality testing, and fast (but meaningless!) ordering for Map-s.fixplatefHash annotation (question: should the Hash field be strict? everything else in the library is lazy...)+This is custom datatype instead of reusing -3 because of the different Eq/Ord instances we need.fixplateThe hash of the complete tree.fixplateThis function uses the  z instance to compute the hash of a node; this way you always have a working version without writing any additional code.sHowever, you can also supply your own hash implementation (which can be more efficient, for example), if you use  instead.fixplate&Build a hashed node from the children. SafeUVfixplateProduct of two functors fixplateSum of two functors      77 6 Safefixplate7 is an efficient(?) implementation of finite maps from (Mu f) to an arbitrary type v.fixplate-Creates a trie-multiset from a list of trees. fixplateThis is equivalent to universeBag == bag . universe4TODO: more efficient implementation? and better name!fixplatePWe attribute each node with the multiset of all its subtrees. TODO: better name)fixplate$TODO: more efficient implementation?-fixplateUnion is left-biased: union == unionWith const !"#$%&'()*+,-./0"#)* !$%&('+,-./0 Safe=? 3fixplate?The zipper type itself, which encodes a locations in thre tree Mu f.7fixplateeThe context or path type. The invariant we must respect is that there is exactly one child with the  constructor.;fixplateA context node. <fixplate9Creates a zipper from a tree, with the focus at the root.=fixplateRestores a tree from a zipper.>fixplate>We attribute all nodes with a zipper focused at that location.?fixplateThe list of all locations.@fixplateThe zipper version of 8.Afixplate*Extracts the subtree at focus. Synonym of 5.BfixplateReplaces the subtree at focus. CfixplateModifies the subtree at focus. DfixplateOMoves down to the child with the given index. The leftmost children has index 0.Efixplate!Moves down to the leftmost child.Ffixplate"Moves down to the rightmost child.Gfixplate Moves up.Jfixplate(Checks whether we are at the top (root).Kfixplate#Checks whether we cannot move down.NfixplateGives back the index of the given location among the children of its parent. Indexing starts from zero. In case of root node (no parent), we also return zero.OfixplateVWe return the full path from the root as a sequence of child indices. This means that Cloc == foldl (flip unsafeMoveDown) (moveTop loc) (fullPathDown loc)Pfixplate!The following equations hold for P and O: _fullPathUp == reverse . fullPathDown loc == foldr unsafeMoveDown (moveTop loc) (fullPathUp loc)Qfixplate*Moves to the top, by repeatedly moving up.RfixplateGMoves left until it can. It should be faster than repeated left steps.SfixplateIMoves right until it can. It should be faster than repeated right steps.'3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY';789:3456<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY !"#$%&'()**+,,-./012345667898:;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                        ! " # $ % & ' ( ) * + , - . / 0 # 1 2 3 4 5 6 7 8 9 9 : ; < = < > ? @ 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 [ \ ] ^ _ ` a b c d d e f g f h i j i k l m n o p q r s t u v w x y z { | } ~ %fixplate-0.1.8-58LhPYmpv9o9IXxSMbvOzpData.Generics.FixplateData.Generics.Fixplate.OpenData.Generics.Fixplate.Base Data.Generics.Fixplate.Morphisms!Data.Generics.Fixplate.Attributes!Data.Generics.Fixplate.TraversalsData.Generics.Fixplate.DrawData.Generics.Fixplate.PrettyData.Generics.Fixplate.HashData.Generics.Fixplate.FunctorData.Generics.Fixplate.TrieData.Generics.Fixplate.ZipperData.Generics.Fixplate.MiscbaseGHC.BasefmapFunctor Data.FoldableFoldableData.Traversable Traversable mapAccumR mapAccumLsequencemapM sequenceAtraverseproductsumminimummaximumelemlengthnulltoListfoldl1foldr1foldlfoldrfoldMap<$CoAttrib unCoAttribAttribunAttribReadF readPrecFShowF showsPrecFOrdFcompareFEqFequalFHoleCoAttrCoAnnPureAttrAnnattrunAnnMuFixunFixisAtomliftAnn liftCoAnn attributeforgetshowFshowsF$fTraversableAnn $fFoldableAnn $fFunctorAnn$fTraversableCoAnn$fFoldableCoAnn$fFunctorCoAnn $fEqFCoAnn$fEqFAnn$fEqMu $fOrdFCoAnn $fOrdFAnn$fOrdMu $fShowFCoAnn $fShowFAnn$fShowMu $fReadFAnn$fReadMu$fTraversableAttrib$fFoldableAttrib$fFunctorAttrib $fShowAttrib$fMonadCoAttrib$fApplicativeCoAttrib$fTraversableCoAttrib$fFoldableCoAttrib$fFunctorCoAttrib$fShowCoAttrib$fEqAnn$fOrdAnn $fShowAnn $fEqCoAnn $fOrdCoAnn $fShowCoAnn$fEqHole $fOrdHolecataparapara'paraListanaapohylozygo_zygohistofutucataMcataM_paraMparaM_paraM'Shape toRevList mapAccumL_ mapAccumR_holes holesListapplybuilderproject unsafeProjectsizeF enumerate enumerateWithenumerateWith_shapezipFunzipFzipWithFunsafeZipWithF zipWithFMunsafeZipWithFM $fOrdShape $fEqShape $fShowShape $fShowVoidannMap synthetise synthetise'synthetiseList synthetiseM synthCatascanCata synthPara synthPara'scanPara synthZygo_ synthZygo synthZygoWithsynthAccumCatasynthAccumPara' mapAccumCata synthCataM synthParaM synthParaM'inheritinherit2inherit'inheritM inheritM_ topDownSweepMtopDownSweepM' synthAccumL synthAccumR synthAccumL_ synthAccumR_enumerateNodesenumerateNodes_synthTransformsynthTransform' synthRewrite synthRewrite'annZip annZipWithannZip3 annZipWith3childrenuniverse transform transformMtopDownTransformtopDownTransformMdescenddescendMrewriterewriteM restructure restructureMcontext contextListfoldLeft foldLeftLazy foldRightdrawTree drawTreeWithshowTree showTreeWith graphvizTreegraphvizTreeWithPrettyfixityshowNode showsPrecNodeFixityAtom ApplicationPrefixInfixPostfixMixfixCustomMixWordKeyword PlaceholderAppStyleHaskellAlgol SeparatorBracketAssocNoAssoc LeftAssoc RightAssocmixWordsfixityPrecedenceprettyprettyS prettyPrec $fEqAssoc $fShowAssoc $fEqBracket $fShowBracket $fEqAppStyle$fShowAppStyle $fEqMixWord $fShowMixWord $fEqFixity $fShowFixity HashValue _emptyHash _hashChar _hashHashHashMuHashAnngetHash unHashAnntopHash forgetHashhashTree hashTreeWithhashNode hashNodeWith$fShowFHashAnn $fOrdFHashAnn $fEqFHashAnn$fTraversableHashAnn$fFoldableHashAnn$fFunctorHashAnn $fShowHashAnn:*::+:InLInR $fShowF:+: $fOrdF:+:$fEqF:+:$fTraversable:+: $fFoldable:+: $fFunctor:+: $fShowF:*: $fOrdF:*:$fEqF:*:$fTraversable:*: $fFoldable:*: $fFunctor:*:$fEq:+:$fOrd:+: $fShow:+:$fEq:*:$fOrd:*: $fShow:*:Triebag universeBag christmasTreeempty singletonlookupinsert insertWithupdatedeletefromList intersectionintersectionWithunion unionWith differencedifferenceWith $fOrdHoleF $fEqHoleFLocfocuspathPathTopunPathNoderootdefocus locations locationsList locForgetextractreplacemodifymoveDown moveDownL moveDownRmoveUp moveRightmoveLeftisTopisBottom isLeftmost isRightmost horizontalPos fullPathDown fullPathUpmoveTopleftmost rightmostunsafeMoveDownunsafeMoveDownLunsafeMoveDownR unsafeMoveUpunsafeMoveLeftunsafeMoveRight $fReadPath $fShowPath$fEqPath $fReadLoc $fShowLoc$fEqLocStateT runStateTBothNoneFirstTwoEmptyOneequating groupSortOnmapGroupSortOnmapGroupSortOn'unsafeapp_prec<#>firstsecond tillNothingchain chainJustiterateNmapM_ mapAccumMswapstatesgetsputsmodifyGHC.ShowShow System.IOputStrLn Data.EitherRight