Ҙǿ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-InferedDThe first part is the name, the second - a list of type parameters, K the third - a list of constructors. For each constructor we have a name - and a list describing constructor fields. type TypeInfo = (Name, [Name], [(Name, [(Maybe Name, Type)])]) *Returns type information of a given type. Apply  to the name. NoneThis function generates a definition of the algebra of a given data structure. For example, given a data structure defined below,  : data BinTree n l = BinNode n (BinTree n l) (BinTree n l)  | BinLeaf l 8the following definition of the algebra is generated by genAlgebraDecl ''BinTree. . data BinTreeAlgebra n l a = BinTreeAlgebra { $ binNode :: n -> a -> a -> a,  binLeaf :: l -> a  } This function generates a definition of a record holding functions to be mapped to values in a given data structure. For example, given a data structure defined below,  : data BinTree n l = BinNode n (BinTree n l) (BinTree n l)  | BinLeaf l %the following record is generated by genMapFunctionsDecl ''BinTree. + data BinTreeMapFs n l b' = BinTreeMapFs {  binNodeF :: n -> b',  binLeafF :: l -> b'  } 'This function generates an instance of P for a given data structure. For example, given a data structure defined below,  : data BinTree n l = BinNode n (BinTree n l) (BinTree n l)  | BinLeaf l %the following record is generated by genInstanceDecl''BinTree. _ instance GenericSemiringStructure (BinTreeAlgebra n l) (BinTree n l) (BinTreeMapFs n l) where + freeAlgebra = BinTreeAlgebra {..} where  binNode = BinNode  binLeaf = BinLeaf 7 pairAlgebra lvta1 lvta2 = BinTreeAlgebra {..} where J binNode a (l1, l2) (r1, r2) = (binNode1 a l1 r1, binNode2 a l2 r2) > binLeaf a = (binLeaf1 a, binLeaf2 a) T (binNode1, binLeaf1) = let BinTreeAlgebra {..} = lvta1 in (binNode, binLeaf) T (binNode2, binLeaf2) = let BinTreeAlgebra {..} = lvta2 in (binNode, binLeaf) X makeAlgebra (CommutativeMonoid {..}) lvta frec fsingle = BinTreeAlgebra {..} where f binNode a l r = foldr oplus identity [fsingle (binNode' a l' r') | l' <- frec l, r' <- frec r] , binLeaf a = fsingle (binLeaf' a) S (binNode', binLeaf') = let BinTreeAlgebra {..} = lvta in (binNode, binLeaf) I foldingAlgebra op iop (BinTreeMapFs {..}) = BinTreeAlgebra {..} where 0 binNode a l r = binNodeF a `op` l `op` r " binLeaf a = binLeafF a ' hom (BinTreeAlgebra {..}) = h where 1 h (BinNode a l r) = binNode a (h l) (h r) % h (BinLeaf a) = binLeaf a  PGiven a data structure, this function generates a definition of its algebra (by genAlgebraDecl!), a record of map functions (by genMapFunctionsDecl), and an instance of  (by genInstanceDecl ). Usage:  genAllDecl ''BinTree. None%%Reverses the order of a given type. Introduces an identity   to a given type. Collection of data-structure-dependent definitions necessary for the GTA framework, including the free algebra, lifting of a generic semirig with an algebra, construction of useful algebras, etc. A generic semiring is a combination of a commutative monoid and an algebra such that operators of the algebra distributes over  and  is the zero of the operators. OFor example, the usual semiring is a combination of a commutative monoid and a  8, in which we have the distributivity and the zeroness: @ a `times` (b `oplus` c) == (a `times` b) `oplus` (a `times` c) @ (a `oplus` b) `times` c == (a `times` c) `oplus` (b `times` c) 6 a `times` identity == identity `times` a == identity dCommutative monoid is an algebra of an associative, commutative binary operator with its identity. ~A bag is a multiset, i.e., a set in which members are allowed to appear more than one. The order of memebrs is ignored: e.g., Bag [1,2] == Bag [2,1] is True. CExtracts members from a bag. The order of members is undecidable. !.Makes a bag that contains the given memebrs. "Combinator for connecting a generator and a filter to build another generator. A fitler is represented by a pair of a judgement function and an algebra. #Combinator for connecting a generator and an aggregator to get the result. An aggregator is represented by a generic semiring. $Combinator for transforming a generator by a transformer. A transformer is an aggregator polymorphic over another generic semiring. % The same as " & The same as # ' The same as $ (Inefficient version of ". (i.e., it does not do optimziation at all). )Inefficient version of #. (i.e., it does not do optimziation at all). *]Operator to build a pair of a judgement function and an algebra, which represents a Tester. +?The aggregator to extract all items generated by a generator. ,gThe aggregator to compute a sum of products. Each product is of all values in the data structure after map. -Introduces an identity. .EThe aggregator to take the maximum items under a given monotonic sum mplus with its identity mid after map. R c == a `max` b => d `mplus` (a `max` b) == (d `mplus` a) `max` (d `mplus` b) /The tupling of maxMonoSumBy and a given generic semiring. The second component of the result is the aggregation of the maximum items by the given generaic semiring. 0]The aggregator to find the best k maximum items under a given monotonic sum. An extension of .. 1The best-k extension of /. 2(The aggregator to the maximum sum after map. 3The best-k extension of 2. 4The best-k extension of 5. 5An instance of / with the usual summation. 6An instance of maxMonoSumsolutionBy with the usual summation. 7The best-k extension of 6. 8.The aggregator to take the maximum product on  non-negative numbers. 9The best-k extension of 8 :The best-k extension of ; ;The tupling of < and a given generic semiring. The second component of the result is the aggregation of the best items by the given generic emiring. <=The aggregator to find the items with the maximum product on  non-negative numbers. =The best-k extension of < >dReverses the order of the argument, so that we can use aggregators maxXXX to take the minimum XXX. ?  !"#$%&'()*+,-./0123456789:;<=>8  !"#$%&'()*+,-./0123456789:;<=>8 !"#$()* >23456789:;<=./01- ,+%&',   !"#$%&'()*+,-./0123456789:;<=>None"?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ SUTOPQRLMNHJIDEFG@ABCV]^\Z[WXYK??@ABCDEFGHJIKLMNOPQRSUTVWXYZ[\]^None0_8The usual semiring is a generic semiring of join lists: @ a `times` (b `oplus` c) == (a `times` b) `oplus` (a `times` c) @ (a `oplus` b) `times` c == (a `times` c) `oplus` (b `times` c) 6 a `times` identity == identity `times` a == identity `AA record to hold a function to be applied to elements of a list. 'This can be generated automatically by  genAllDecl ''JoinList. bThe algebra of join lists. We assume that d is associative and f& is its identity, inheriting those of j and h:  4 x `times` (y `times` z) == (x `times` y) `times` z % x `times` nil == nil `times` x == x 'This can be generated automatically by  genAllDecl ''JoinList. g Join lists.   x ++ y ==> x `Times` y  [a] ==> Single a  [] ==> Nil We assume that j is associative and h is its identity: 4 x `Times` (y `Times` z) == (x `Times` y) `Times` z % x `Times` Nil == Nil `Times` x == x k/A wrapper function for JoinList homomorphism. l!A fake function of homJ to build b1 instead of executing the homomorphism with it. m Property of d of a JoinListAlgebra: 4 x `times` (y `times` z) == (x `times` y) `times` z n Property of d and f of a JoinListAlgebra: . (x `times` nil == x) && (nil `times` x == x) o.Conversion from a usual list to a join list. p.Conversion from a join list to a usual list. qHThis generates all segments (continuous subsequences) of a given list. For example, !segs [1,2,3] `aggregateBy` result(Bag [[1],[2],[3],[2,3],[1,2],[1,2,3],[]]r.This generates all prefixes of a given list. For example, "inits [1,2,3] `aggregateBy` resultBag [[],[1],[1,2],[1,2,3]]s.This generates all suffixes of a given list. For example, "tails [1,2,3] `aggregateBy` resultBag [[1,2,3],[2,3],[3],[]]t2This generates all subsequences of a given list. For example, !subs [1,2,3] `aggregateBy` result.Bag [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]u]This generates all assignments of elements of the first list to elements of the second list. For example, 1assigns [True,False] [1,2,3] `aggregateBy` resultBag [[(True,1),(True,2),(True,3)],[(True,1),(True,2),(False,3)],[(True,1),(False,2),(True,3)],[(True,1),(False,2),(False,3)],[(False,1),(True,2),(True,3)],[(False,1),(True,2),(False,3)],[(False,1),(False,2),(True,3)],[(False,1),(False,2),(False,3)]]vThis is a generalization of u8: the values to be assigned is dependent of the target. For example, VassignsBy (\a -> if odd a then [True, False] else [True]) [1,2,3] `aggregateBy` result}Bag [[(True,1),(True,2),(True,3)],[(True,1),(True,2),(False,3)],[(False,1),(True,2),(True,3)],[(False,1),(True,2),(False,3)]]w1This generates all permutations of a given list. For example, !perms "hoge" `aggregateBy` resultBag ["hoge","hoeg","ohge","oheg","hgoe","hgeo","ghoe","gheo","heog","hego","ehog","ehgo","oghe","ogeh","gohe","goeh","oehg","oegh","eohg","eogh","geho","geoh","egho","egoh"]xXA transfomer that applies given function to every element in every list in a given bag. yIThis generates all paths from the root to leaves of a given binary tree. For example, n*Main GTA.Data.BinTree> paths (BinNode 1 (BinLeaf 2) (BinNode 3 (BinLeaf 4) (BinLeaf 5))) `aggregateBy` resultBag [[1,2],[1,3,4],[1,3,5]]z Wrapper for `. {@The aggregator to count the number of items in a generated bag. |(The aggregator to take the maximum sum. }3The aggregator to find items with the maximum sum. ~-The aggregator to take the maximum sum after map f. The best-k extension of ~. The best-k extension of . The tupling of maxsumsolution and a given semiring. The second component is the aggregation of the maximum items by the given semiring. 8The aggregator to find items with the maximum sum after map f. The best-k extension of . .The aggregator to take the maximum product of  non-negative numbers after map f. The best-k extension of . The best-k extension of . The tupling of maxprodsolution and a given semiring. The second component is the aggregation of the maximum items by the given semiring. NThe aggregator to find items with the maximum product. The numbers have to be  non-negative. The best-k extension of . Parallel version of q. Parallel version of r. Parallel version of s. Parallel version of t. Parallel version of u. Parallel version of v. Parallel version of w. $Constructor of a bag of join lists.  For example, O(bag (map joinize [[1,2], [3]])) `crossConcat` (bag (map joinize [[4,5], [6]]))%Bag [[1,2,4,5],[1,2,6],[3,4,5],[3,6]]$Constructor of a bag of join lists.  For example, bagOfSingleton 1 Bag [[1]]$Constructor of a bag of join lists.  For example, bagOfNilBag [[]]$Constructor of a bag of join lists.  For example, emptyBagBag []$Constructor of a bag of join lists.  For example, L(bag (map joinize [[1,2], [3]])) `bagUnion` (bag (map joinize [[4,5], [6]]))Bag [[1,2],[3],[4,5],[6]]wInstance declaration of GTA.Data.GenericSemiringStructure for join lists. The implementation is quite straightforward. 'This can be generated automatically by  genAllDecl ''JoinList. =_`abcdefghijklmnopqrstuvwxyz{|}~7_`abcdefghijklmnopqrstuvwxyz{|}~7gjihbcdefopqrstuyvz{|}~_mn`aklxw5_`abcdefgjihklmnopqrstuvwxyz{|}~None/**)      !"##$%&'()*+,-./0123456789:;<=>?@ABCDDEFGGHIJKLMNNOPPQRSTUVWXYZ[\]^_`a  bcdefghijklmnopqrstuvwxWXYyz{|}~dfopqrstuwWXYyz{|}~v GTALib-0.0.6GTA.Util.TypeInfo)GTA.Util.GenericSemiringStructureTemplateGTA.CoreGTA.Data.BinTreeGTA.Data.JoinListGTA.Data.ConsListGTA.DataGenericSemiringStructureJoinListAlgebraTypeInfotypeInfo simpleNamegenAlgebraDeclgenMapFunctionsDeclgenInstanceDecl genAllDeclRevOrd AddIdentityIdentity freeAlgebra pairAlgebra makeAlgebrafoldingAlgebrahom freeSemiringliftedSemiring pairSemiringshomGenericSemiringmonoidalgebraCommutativeMonoidoplusidentityBagitemsbag>==>=>>=<filterBy aggregateBy transformBy>##>#><.>result sumproductBy addIdentity maxMonoSumBymaxMonoSumsolutionXBy maxMonoSumKBymaxMonoSumsolutionXKBymaxsumBy maxsumKBymaxsumsolutionXKBymaxsumsolutionXBymaxsumsolutionBymaxsumsolutionKBy maxprodBy maxprodKBymaxprodsolutionXKBymaxprodsolutionXBymaxprodsolutionBymaxprodsolutionKByrevOrdBinTreeSemiring BinTreeMapFsbinNodeFbinLeafFBinTreeAlgebrabinNodebinLeafBinTreeBinLeafBinNodeLVTreeSemiring LVTreeMapFsleafLVF LVTreeAlgebranodeLVleafLVLVTreeLeafLVNodeLVlvtreescountmaxsummaxsumsolution assignTrans assignTreesselectssubtreeSelectsWithRootsubtreeSelectsSemiring JoinListMapFssingleFtimessinglenilJoinListNilSingleTimeshomJhomJ'prop_Associativity prop_Identityjoinize dejoinizesegsinitstailssubsassigns assignsBypermsmapMappathsmapJ maxsumWith maxsumKWithmaxsumsolutionXKWithmaxsumsolutionXWithmaxsumsolutionWithmaxsumsolutionKWith maxprodWith maxprodKWithmaxprodsolutionXKWithmaxprodsolutionXWithmaxprodsolutionWithmaxprodsolutionKWithsegsPinitsPtailsPsubsPassignsP assignsByPpermsP crossConcatbagOfSingletonbagOfNilemptyBagbagUnion ConsSemiring ConsListMapFsconsFConsListAlgebraconsConsListConsconsize deconsizefoldr'mapC crossConstemplate-haskellLanguage.Haskell.TH.SyntaxnameBase$fNFDataRevOrd $fOrdRevOrd $fNumRevOrd$fNFDataAddIdentity$fOrdAddIdentity$fEqBag $fNFDataBag;$fGenericSemiringStructureBinTreeAlgebraBinTreeBinTreeMapFs8$fGenericSemiringStructureLVTreeAlgebraLVTreeLVTreeMapFs>$fGenericSemiringStructureJoinListAlgebraJoinListJoinListMapFs $fOrdJoinList $fEqJoinList$fReadJoinList$fShowJoinList$fNFDataJoinList $fOrdConsList $fEqConsList$fReadConsList$fShowConsList>$fGenericSemiringStructureConsListAlgebraConsListConsListMapFs