*zq      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = >?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopSafe %0Note that the returned list is ordered by hash, not by keys like !'1Keys together with their associated unique values))Look up a unique index, in the form of a  (hash,Int)6 pair, for any key. If the user-supplied function is  injective, then the result is guaranteed to be uniquely associated to the given key in the past and future history of this table (but of course not unique among different future histories).. union == unionWith const/)This is unsafe in the sense that the two getHashr functions (supplied when the hash tables were created) must agree. The same applies for all the set operations.It is also left-biased in the sense that the unique indices from the left hashtable are retained, while the unique indices from the right hashtable are changed.0This is unsafe both in the above sense and also that it does not accepts the empty list (for the same reason). The result belongs to the world-line of the first table.1JThis one accepts the empty list. The empty imput creates a new world-line.2 &intersection == intersectionWith const8 Creates a multi-set from a list.&q !rstuvw"#$%&'()*+,-./0123456789 !"#$%&'()*+,-./0123456789! !"#$%&8(*+,-./01234567)'9!q !rstuvw"#$%&'()*+,-./0123456789Safe:KA type class of hashable objects. An instance has to compute the hash for any4 hash function, using the "base" types (eg. Word32).Minimal complete definition: ;. The default for < is &computeHash x = hashDigest x emptyHash=7A type class for hashes. Minimal complete definition: B, >, C and D.:;<=>?@ABCDEFGHIJKLMNOPQRSTU:;<=>?@ABCDEFGH=>?@ABCD:;<UTSRQPONMLKJIEFGH:;<=>?@ABCDEFGHIJKLMNOPQRSTUSafe VWXxyz{|}~VWXVWX VWXxyz{|}~Safe YZ[YZ[YZ[ YZ[Safe"Safe\Categorial dual of _. Equivalent to the free monad._A 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.hd"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 = readPrecjdThis 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 _ = "_"lCategorical dual of p. Equivalent to Free f amCategorical dual of q.p*Annotated fixed-point type. Equivalent to  CoFree f aqType of annotationssthe annotationtthe original functoruThe fixed-point type.x.We call a tree "atomic" if it has no subtrees.y/Lifting natural transformations to annotations.z/Lifting natural transformations to annotations.{The attribute of the root node.|@A function forgetting all the attributes from an annotated tree. NOTE: The f- 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. NOTE: The hO instance for annotations compares both the annotations and the original part. >\]^_`abcdefghijklmnopqrstuvwxyz{|}~#\]^_`abcdefghijklmnopqrstuvwxyz{|}~>uvwxqrstpymnolz{|jkhifgdebc}~_`a\]^.\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe A  catamorphism9 is the generalization of right fold from lists to trees.A  paramorphism/ is a more general version of the catamorphism.Another version of $ (a bit less natural in some sense).A list version of  (compare with Uniplate)An  anamorphism? is simply an unfold. Probably not very useful in this context.An  apomorphism( is a generalization of the anamorphism.A  hylomorphism9 is the composition of a catamorphism and an anamorphism.A  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)HHistomorphism. 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)))0Futumorphism. This is a more interesting unfold.Monadic catamorphism.Monadic paramorphism.Another version of .Safe A 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.Equivalent to reverse . toList.IThe children together with functions replacing that particular child. /Apply the given function to each child in turn.Builds 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.Extracts the ith child.2Number of children. This is the generalization of  to foldable functors: sizeF x = length (toList x)Enumerates children from the left to the right, starting with zero. Also returns the number of children. This is just a simple application of .%Extracting the "shape" of the functor+Zips two structures if they are compatible.(Zipping two structures using a function.Unsafe 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.Monadic version of . TODO: better name?jkjk Safe The list of direct descendants.The 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 ]Bottom-up transformation.NTop-down transformation. This provided only for completeness; usually, it is  what you want use instead.>Non-recursive top-down transformation. This is basically just ."Similarly, this is basically just .8Bottom-up transformation until a normal form is reached.Bottom-up transformation (typically "shallow", that is, restricted to a single level) which can change the structure functor (actually  is a special case of this).We annotateM the nodes of the tree with functions which replace that particular subtree.Flattened version of .(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. SafeMap over annotations %annMap f = unAttrib . fmap f . Attrib 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 .Generalization of scanr for trees. See also .List version of  (compare with Uniplate)Monadic version of . Synonym for , motivated by the equation " attribute . synthCata f == cata fVThat is, it attributes all subtrees with the result of the corresponding catamorphism. 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.JAttributes all subtrees with the result of the corresponding paramorphism. " attribute . synthPara f == para fAnother version of . $ attribute . synthPara' f == para' fSynthetising zygomorphism. 'attribute . synthZygo_ g h == zygo_ g h.Accumulating catamorphisms. Generalization of  from lists to trees.Accumulating paramorphisms. Could 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) Synonym for $. If you don't need the result, use cataM_ instead.Monadic version of %. If you don't need the result, use paraM_ instead.Monadic version of .  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) 0Generalization of . TODO: better name?Generalization of scanl from lists to trees.Monadic version of .WMonadic 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?An attributed version of . Probably more useful.iSynthetising attributes via an accumulating map in a left-to-right fashion (the order is the same as in foldl).iSynthetising attributes via an accumulating map in a right-to-left fashion (the order is the same as in foldr).We 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.[Bottom-up transformations which automatically resynthetise attributes in case of changes.Bottom-up transformations to normal form (applying transformation exhaustively) which automatically resynthetise attributes in case of changes.3Merges two layers of annotations into a single one.5Merges three layers of annotations into a single one.(+_`a+_`a( Safe&Prints a tree. It is defined simply as drawTree = putStrLn . showTree:Creates a string representation which can be printed with .Generate a graphviz .dot file  Safe35?The zipper type itself, which encodes a locations in thre tree Mu f.eThe context or path type. The invariant we must respect is that there is exactly one child with the  constructor.A context node. 9Creates a zipper from a tree, with the focus at the root.Restores a tree from a zipper. >We attribute all nodes with a zipper focused at that location. The list of all locations. The zipper version of |. *Extracts the subtree at focus. Synonym of . Replaces the subtree at focus. Modifies the subtree at focus. OMoves down to the child with the given index. The leftmost children has index 0.!Moves down to the leftmost child."Moves down to the rightmost child. Moves up.(Checks whether we are at the top (root).#Checks whether we cannot move down.Gives 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.VWe return the full path from the root as a sequence of child indices. This means that Cloc == foldl (flip unsafeMoveDown) (moveTop loc) (fullPathDown loc)!The following equations hold for  and : _fullPathUp == reverse . fullPathDown loc == foldr unsafeMoveDown (moveTop loc) (fullPathUp loc)*Moves to the top, by repeatedly moving up.GMoves left until it can. It should be faster than repeated left steps.IMoves right until it can. It should be faster than repeated right steps.-      !"#$%&'()*'      !"#$-*)('&%      !"#$'      !"#$%&'()* Safe++7 is an efficient(?) implementation of finite maps from (Mu f) to an arbitrary type v.,-Creates a trie-multiset from a list of trees.-This is equivalent to universeBag == bag . universe4TODO: more efficient implementation? and better name.PWe attribute each node with the multiset of all its subtrees. TODO: better name6$TODO: more efficient implementation?:Union is left-biased: union == unionWith const/+,-./0123456789:;<=+,-./0123456789:;<=+/067,-.1235489:;<=)+,-./0123456789:;<=Safe \]^_`abcdefghijklmnopqrstuvwxyz{|}~  SafeKL>Product of two functors@Sum of two functors>?@AB>?@AB@AB>?>?@AB>?@SafeC;A class encoding fixity and rendering of nodes if the tree.Minimum complete definition: D, and E or FX. Unless you want some type of rendering not directly supported, you shouldn't specify F.Dfixity of the nodeEa string representing the node without the childrenFHfull rendering of the node. You can redefine this for custom renderings.G>Fixities. TODO: separate non-fixity stuff like style and wordsHeg. variable; precedence will be 666Ieg. (Node arg1 arg2 arg3) or node[arg1,arg2,arg3].Jeg. ~arg; the Int is the precendenceKeg. x+yLeg. arg++Meg. if ... then ... else ...  or let ... in .... With precedence 0?Nfor your custom renderingOMixfix style. Example: \[ Keyword "if" , Placeholder , keyword "then" , Placeholder , keyword "else" , Placeholder ]RApplication style Seg. (Node arg1 arg2 arg3); precedence will be app_prec == 10Teg. node[arg1,arg2,arg3]C; precedence will be 11, but child environment precedence will be 0UA separator, eg. "," or " | ".V!A pair of matching brackets, eg. Bracket "(" ")" or Bracket "[|" "|]".X Associativity^Render the expressionCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`XYZ[VWURSTOPQ\GHIJKLMN]CDEF^_` CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`Safe a@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.c"the hash of an empty byte sequenceddigest a (unicode) characteredigest a hash value fA tree annotated with hashes of all subtrees. This gives us fast inequality testing, and fast (but meaningless!) ordering for Map-s.gfHash annotation (question: should the Hash field be strict? everything else in the library is lazy...)+This is custom datatype instead of reusing q3 because of the different Eq/Ord instances we need.kThe hash of the complete tree.mThis function uses the dz 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 n instead.o&Build a hashed node from the children.abcdefghijklmnopabcdefghijklmnopghijfklabcdemnopabcdefghijklmnop !"#$%&'()*+,-./012345667789:)(;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijjkllmnnoppqrstuvwxyzz{|}|~                                    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 L 7 8 8 9 < ? @ 9 A : ) F G B C J K::;<=>?@ABCDEFGHIJKLMNOPQQRSTUVWXYZQQ[\]^__`abcdefg3hijklmnopqrstuvwxyz{|}~                     6       h              fixpl_7oRQWr2sjum8oa3IVpNskHData.Generics.FixplateData.Generics.Fixplate.Open&Data.Generics.Fixplate.Util.Hash.Table&Data.Generics.Fixplate.Util.Hash.Class*Data.Generics.Fixplate.Util.Hash.FNV.FNV32*Data.Generics.Fixplate.Util.Hash.FNV.FNV64Data.Generics.Fixplate.Base Data.Generics.Fixplate.Morphisms!Data.Generics.Fixplate.Traversals!Data.Generics.Fixplate.AttributesData.Generics.Fixplate.DrawData.Generics.Fixplate.ZipperData.Generics.Fixplate.TrieData.Generics.Fixplate.FunctorData.Generics.Fixplate.PrettyData.Generics.Fixplate.HashDataMapData.Generics.Fixplate.MiscbaseGHC.BasefmapFunctor Data.FoldableFoldableData.Traversable Traversable mapAccumR mapAccumLsequencemapM sequenceAtraverseproductsumminimummaximumelemlengthnulltoListfoldl1foldr1foldl'foldlfoldr'foldrfoldMapfold<$ HashTable getHashValue unHashTableBucketLeafempty singletonfromListkeysWithlookupgetUniqueIndexmemberinsert insertWithdeleteunion unionWith unionsWith unionsWith' intersectionintersectionWithintersectionsWithintersectionsWith' differencedifferenceWithbagmapWithUniqueIndicesHashable hashDigest computeHash HashValue hashWord8 hashWord16 hashWord32 hashWord64 emptyHashhashHashshowHexhashInthashWordhashBoolhashChar$fHashable(,,,,)$fHashable(,,,)$fHashable(,,) $fHashable(,) $fHashable[]$fHashableChar$fHashableBool$fHashableWord $fHashableInt$fHashableWord64$fHashableWord32$fHashableWord16$fHashableWord8FNV32unFNV32FNV64unFNV64CoAttrib unCoAttribAttribunAttribReadF readPrecFShowF showsPrecFOrdFcompareFEqFequalFHoleCoAttrCoAnnPureAttrAnnattrunAnnMuFixunFixisAtomliftAnn liftCoAnn attributeforgetshowFshowsF$fMonadCoAttrib$fApplicativeCoAttrib$fTraversableCoAttrib$fFoldableCoAttrib$fFunctorCoAttrib$fShowCoAttrib$fTraversableAttrib$fFoldableAttrib$fFunctorAttrib $fShowAttrib$fTraversableCoAnn$fFoldableCoAnn$fFunctorCoAnn$fTraversableAnn $fFoldableAnn $fFunctorAnn $fShowFCoAnn $fOrdFCoAnn $fEqFCoAnn $fReadFAnn $fShowFAnn $fOrdFAnn$fEqFAnn$fReadMu$fShowMu$fOrdMu$fEqMucataparapara'paraListanaapohylozygo_zygohistofutucataMcataM_paraMparaM_paraM'Shape toRevList mapAccumL_ mapAccumR_holes holesListapplybuilderproject unsafeProjectsizeF enumerate enumerateWithenumerateWith_shapezipFunzipFzipWithFunsafeZipWithF zipWithFMunsafeZipWithFMchildrenuniverse transform transformMtopDownTransformtopDownTransformMdescenddescendMrewriterewriteM restructure restructureMcontext contextListfoldLeft foldLeftLazy foldRightannMap 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 annZipWith3drawTree drawTreeWithshowTree showTreeWith graphvizTreegraphvizTreeWithLocfocuspathPathTopunPathNoderootdefocus locations locationsList locForgetextractreplacemodifymoveDown moveDownL moveDownRmoveUp moveRightmoveLeftisTopisBottom isLeftmost isRightmost horizontalPos fullPathDown fullPathUpmoveTopleftmost rightmostunsafeMoveDownunsafeMoveDownLunsafeMoveDownR unsafeMoveUpunsafeMoveLeftunsafeMoveRight $fReadLoc $fReadPath $fShowLoc $fShowPath$fEqLoc$fEqPathTrie universeBag christmasTreeupdate:*::+:InLInRPrettyfixityshowNode showsPrecNodeFixityAtom ApplicationPrefixInfixPostfixMixfixCustomMixWordKeyword PlaceholderAppStyleHaskellAlgol SeparatorBracketAssocNoAssoc LeftAssoc RightAssocmixWordsfixityPrecedenceprettyprettyS prettyPrec _emptyHash _hashChar _hashHashHashMuHashAnngetHash unHashAnntopHash forgetHashhashTree hashTreeWithhashNode hashNodeWith mapInsertWithfromLeaf emptyBucketbucketSingleton bucketInsertbucketInsertWith showHex32 fnv32_prime fnv32_offset fnv32_octet fnv32_word32 fnv32_word16 fnv32_word64$fHashValueFNV32$fHashableFNV32 showHex64 fnv64_prime fnv64_offset fnv64_octet fnv64_word32 fnv64_word16 fnv64_word64$fHashValueFNV64$fHashableFNV64StateT runStateTBothNoneFirstTwoEmptyOneequating groupSortOnmapGroupSortOnmapGroupSortOn'unsafeapp_prec<#>firstsecond tillNothingchain chainJustiterateNmapM_ mapAccumMswapstatesgetsputsmodify $fMonadStateT$fApplicativeStateT$fFunctorStateTGHC.ShowShowVoidunShape $fShowShape $fShowVoid $fOrdShape $fEqShape System.IOputStrLnStyle _twigNorm _twigLast _branchNorm _branchLastStep defaultStyle_twig_branchescape Data.EitherRightHoleFunHoleFChainValueunTrie emptyTrie trieLookup chainLookupchainSingleton trieSingletontrieInsertWithchainInsertWith trieUpdate chainUpdate trieToList chainToListchainIntersectionWithtrieIntersectionWithchainUnionWith trieUnionWithchainDifferenceWithtrieDifferenceWith $fOrdHoleF $fEqHoleFmul_prec $fShowF:*: $fOrdF:*:$fEqF:*: $fShowF:+: $fOrdF:+:$fEqF:+:$fTraversable:*: $fFoldable:*: $fFunctor:*:$fTraversable:+: $fFoldable:+: $fFunctor:+: showDigest _hashString _computeHash$fShowFHashAnn $fOrdFHashAnn $fEqFHashAnn$fTraversableHashAnn$fFoldableHashAnn$fFunctorHashAnn