-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for GTA programming -- -- This package provides the core functionalities of the GTA (Generate, -- Test, and Aggregate) programming framework on Haskell (c.f., Kento -- Emoto, Sebastian Fischer, Zhenjiang Hu: Generate, Test, and Aggregate -- - A Calculation-based Framework for Systematic Parallel Programming -- with MapReduce. ESOP 2012: 254-273). (This version is a very early -- version and dirty. The source files will be cleaned and documented -- soon.) @package GTALib @version 0.0.2 -- | Observing a structure of a datatype in a uniform way no matter whether -- it was defined in infix, prefix or record form. -- -- This code is based on the Derive module from the SYB3 code -- distribution, (C) 2005, Ralf Laemmel and Simon Peyton Jones, see -- http://homepages.cwi.nl/~ralf/syb3/code.html. module GTA.Util.TypeInfo -- | The first part is the name, the second - a list of type parameters, -- the third - a list of constructors. For each constructor we have a -- name and a list describing constructor fields. type TypeInfo = (Name, [TyVarBndr], [(Name, [(Maybe Name, Type)])]) typeInfo :: Name -> Q TypeInfo -- | Apply nameBase to the name. simpleName :: Name -> Name module GTA.Util.GenericSemiringStructureTemplate genAlgebraDecl :: Name -> Q [Dec] genMapFunctionsDecl :: Name -> Q [Dec] genInstanceDecl :: Name -> Q [Dec] genAllDecl :: Name -> Q [Dec] module GTA.Core data Bag a Bag :: [a] -> Bag a data CommutativeMonoid a CommutativeMonoid :: (a -> a -> a) -> a -> CommutativeMonoid a oplus :: CommutativeMonoid a -> a -> a -> a identity :: CommutativeMonoid a -> a data GenericSemiring alg a GenericSemiring :: CommutativeMonoid a -> alg a -> GenericSemiring alg a monoid :: GenericSemiring alg a -> CommutativeMonoid a algebra :: GenericSemiring alg a -> alg a class GenericSemiringStructure alg free uniformer | alg -> free, alg -> uniformer where freeSemiring = GenericSemiring {..} where monoid = bagMonoid algebra = makeAlgebra bagMonoid freeAlgebra items singletonBag liftedSemiring s a = GenericSemiring {monoid = monoid', algebra = algebra'} where monoid' = let GenericSemiring {..} = s in mapMonoid monoid algebra' = makeAlgebra (mapMonoid (monoid s)) (pairAlgebra a (algebra s)) assocs (uncurry singleton) shom (GenericSemiring {..}) = sh where CommutativeMonoid {..} = monoid sh (Bag b) = foldr oplus identity (map (hom algebra) b) pairSemiring s1 s2 = GenericSemiring {monoid = monoid', algebra = algebra'} where monoid' = pairMonoid (monoid s1) (monoid s2) algebra' = pairAlgebra (algebra s1) (algebra s2) freeSemiring :: GenericSemiringStructure alg free uniformer => GenericSemiring alg (Bag free) liftedSemiring :: (GenericSemiringStructure alg free uniformer, Ord c) => GenericSemiring alg a -> alg c -> GenericSemiring alg (Map c a) pairSemiring :: GenericSemiringStructure alg free uniformer => GenericSemiring alg a -> GenericSemiring alg b -> GenericSemiring alg (a, b) shom :: GenericSemiringStructure alg free uniformer => GenericSemiring alg a -> Bag free -> a makeAlgebra :: GenericSemiringStructure alg free uniformer => (CommutativeMonoid m) -> (alg a) -> (m -> [a]) -> (a -> m) -> alg m pairAlgebra :: GenericSemiringStructure alg free uniformer => alg a -> alg b -> alg (a, b) freeAlgebra :: GenericSemiringStructure alg free uniformer => alg free hom :: GenericSemiringStructure alg free uniformer => alg a -> free -> a foldingAlgebra :: GenericSemiringStructure alg free uniformer => (a -> a -> a) -> a -> uniformer a -> alg a bag :: [a] -> Bag a (>==) :: (GenericSemiringStructure alg free uniformer, Ord c) => (GenericSemiring alg (Map c b) -> Map k b) -> (k -> Bool, alg c) -> GenericSemiring alg b -> b (>=>) :: GenericSemiringStructure alg free uniformer => (GenericSemiring alg b -> b) -> GenericSemiring alg b -> b (>=<) :: (GenericSemiringStructure alg free uniformer, GenericSemiringStructure alg' free' uniformer') => (GenericSemiring alg' c -> c) -> (GenericSemiring alg c -> GenericSemiring alg' c) -> GenericSemiring alg c -> c (>##) :: GenericSemiringStructure alg free uniformer => (GenericSemiring alg (Bag free) -> Bag free) -> (b -> Bool, alg b) -> GenericSemiring alg (Bag free) -> Bag free (>#>) :: GenericSemiringStructure alg free uniformer => (GenericSemiring alg (Bag free) -> Bag free) -> GenericSemiring alg a -> a (<.>) :: t -> t1 -> (t, t1) items :: Bag a -> [a] revOrd :: a -> RevOrd a data RevOrd a RevOrd :: a -> RevOrd a maxsumBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a) maxsumKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => Int -> uniformer (AddIdentity a) -> GenericSemiring alg [AddIdentity a] maxsumsolutionXKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => GenericSemiring alg b -> Int -> uniformer (AddIdentity a) -> GenericSemiring alg [(AddIdentity a, b)] maxsumsolutionXBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => GenericSemiring alg t -> uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a, t) maxsumsolutionBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a, Bag free) maxsumsolutionKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => Int -> uniformer (AddIdentity a) -> GenericSemiring alg [(AddIdentity a, Bag free)] maxprodBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a) maxprodKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => Int -> uniformer (AddIdentity a) -> GenericSemiring alg [AddIdentity a] maxprodsolutionXKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => GenericSemiring alg b -> Int -> uniformer (AddIdentity a) -> GenericSemiring alg [(AddIdentity a, b)] maxprodsolutionXBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => GenericSemiring alg t -> uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a, t) maxprodsolutionBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a, Bag free) maxprodsolutionKBy :: (GenericSemiringStructure alg free uniformer, Ord a, Num a) => Int -> uniformer (AddIdentity a) -> GenericSemiring alg [(AddIdentity a, Bag free)] maxMonoSumBy :: (GenericSemiringStructure alg free uniformer, Ord a) => (a -> a -> a) -> a -> uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a) maxMonoSumsolutionXBy :: (GenericSemiringStructure alg free uniformer, Ord a) => (a -> a -> a) -> a -> GenericSemiring alg t -> uniformer (AddIdentity a) -> GenericSemiring alg (AddIdentity a, t) maxMonoSumKBy :: (GenericSemiringStructure alg free uniformer, Ord a) => (a -> a -> a) -> a -> Int -> uniformer (AddIdentity a) -> GenericSemiring alg [AddIdentity a] maxMonoSumsolutionXKBy :: (GenericSemiringStructure alg free uniformer, Ord a) => (a -> a -> a) -> a -> GenericSemiring alg b -> Int -> uniformer (AddIdentity a) -> GenericSemiring alg [(AddIdentity a, b)] addIdentity :: a -> AddIdentity a data AddIdentity a AddIdentity :: a -> AddIdentity a Identity :: AddIdentity a sumproductBy :: (GenericSemiringStructure alg free uniformer, Num a) => uniformer a -> GenericSemiring alg a result :: GenericSemiringStructure alg free uniformer => GenericSemiring alg (Bag free) filterBy :: (GenericSemiringStructure alg free uniformer, Ord c) => (GenericSemiring alg (Map c b) -> Map k b) -> (k -> Bool, alg c) -> GenericSemiring alg b -> b aggregateBy :: GenericSemiringStructure alg free uniformer => (GenericSemiring alg b -> b) -> GenericSemiring alg b -> b transformBy :: (GenericSemiringStructure alg free uniformer, GenericSemiringStructure alg' free' uniformer') => (GenericSemiring alg' c -> c) -> (GenericSemiring alg c -> GenericSemiring alg' c) -> GenericSemiring alg c -> c instance [overlap ok] Show a => Show (Bag a) instance [overlap ok] Ord a => Ord (Bag a) instance [overlap ok] Read a => Read (Bag a) instance [overlap ok] Show a => Show (AddIdentity a) instance [overlap ok] Eq a => Eq (AddIdentity a) instance [overlap ok] Read a => Read (AddIdentity a) instance [overlap ok] Eq a => Eq (RevOrd a) instance [overlap ok] Show a => Show (RevOrd a) instance [overlap ok] Read a => Read (RevOrd a) instance [overlap ok] Ord a => Ord (RevOrd a) instance [overlap ok] Num a => Num (RevOrd a) instance [overlap ok] Ord a => Ord (AddIdentity a) instance [overlap ok] (Eq a, Ord a) => Eq (Bag a) module GTA.Data.BinTree data LVTree a NodeLV :: (LVTree a) -> (LVTree a) -> LVTree a LeafLV :: a -> LVTree a data LVTreeAlgebra a_abKW a LVTreeAlgebra :: (a -> a -> a) -> (a_abKW -> a) -> LVTreeAlgebra a_abKW a nodeLV :: LVTreeAlgebra a_abKW a -> a -> a -> a leafLV :: LVTreeAlgebra a_abKW a -> a_abKW -> a data LVTreeMapFs a_abKW a LVTreeMapFs :: (a_abKW -> a) -> LVTreeMapFs a_abKW a leafLVF :: LVTreeMapFs a_abKW a -> a_abKW -> a data BinTree n l BinNode :: n -> (BinTree n l) -> (BinTree n l) -> BinTree n l BinLeaf :: l -> BinTree n l data BinTreeAlgebra n_abOE l_abOF a BinTreeAlgebra :: (n_abOE -> a -> a -> a) -> (l_abOF -> a) -> BinTreeAlgebra n_abOE l_abOF a binNode :: BinTreeAlgebra n_abOE l_abOF a -> n_abOE -> a -> a -> a binLeaf :: BinTreeAlgebra n_abOE l_abOF a -> l_abOF -> a data BinTreeMapFs n_abOE l_abOF a BinTreeMapFs :: (n_abOE -> a) -> (l_abOF -> a) -> BinTreeMapFs n_abOE l_abOF a binNodeF :: BinTreeMapFs n_abOE l_abOF a -> n_abOE -> a binLeafF :: BinTreeMapFs n_abOE l_abOF a -> l_abOF -> a lvtrees :: [a] -> LVTreeSemiring a s -> s subtreeSelectsWithRoot :: BinTree n l -> BinTreeSemiring (Bool, n) (Bool, l) a -> a subtreeSelects :: BinTree n l -> BinTreeSemiring (Bool, n) (Bool, l) a -> a selects :: BinTree n l -> BinTreeSemiring (Bool, n) (Bool, l) a -> a assignTrans :: [b] -> [c] -> BinTreeSemiring c (b, a) s -> LVTreeSemiring a s assignTrees :: [b] -> [c] -> [a] -> BinTreeSemiring c (b, a) s -> s count :: Num a => BinTreeSemiring n l a maxsum :: (Num a, Ord a) => BinTreeSemiring (Bool, a) (Bool, a) (AddIdentity a) maxsumsolution :: (Num a, Ord a) => BinTreeSemiring (Bool, a) (Bool, a) (AddIdentity a, Bag (BinTree (Bool, a) (Bool, a))) instance [overlap ok] Show RtStClass instance [overlap ok] Eq RtStClass instance [overlap ok] Ord RtStClass instance [overlap ok] Read RtStClass instance [overlap ok] Show StClass instance [overlap ok] Eq StClass instance [overlap ok] Ord StClass instance [overlap ok] Read StClass instance [overlap ok] GenericSemiringStructure (BinTreeAlgebra n0 l0) (BinTree n0 l0) (BinTreeMapFs n0 l0) instance [overlap ok] (Eq n, Eq l) => Eq (BinTree n l) instance [overlap ok] (Ord n, Ord l) => Ord (BinTree n l) instance [overlap ok] (Read n, Read l) => Read (BinTree n l) instance [overlap ok] GenericSemiringStructure (LVTreeAlgebra a0) (LVTree a0) (LVTreeMapFs a0) instance [overlap ok] Eq a => Eq (LVTree a) instance [overlap ok] Ord a => Ord (LVTree a) instance [overlap ok] Read a => Read (LVTree a) module GTA.Data.JoinList data JoinList a Times :: (JoinList a) -> (JoinList a) -> JoinList a Single :: a -> JoinList a Nil :: JoinList a data JoinListAlgebra a_agjt a JoinListAlgebra :: (a -> a -> a) -> (a_agjt -> a) -> a -> JoinListAlgebra a_agjt a times :: JoinListAlgebra a_agjt a -> a -> a -> a single :: JoinListAlgebra a_agjt a -> a_agjt -> a nil :: JoinListAlgebra a_agjt a -> a joinize :: [a] -> JoinList a dejoinize :: JoinList a -> [a] segs :: [a] -> Semiring a s -> s inits :: [a] -> Semiring a s -> s tails :: [a] -> Semiring a s -> s subs :: [a] -> Semiring a s -> s assigns :: [m] -> [a] -> Semiring (m, a) s -> s paths :: BinTree a a -> Semiring a s -> s mapJ :: (b -> a) -> JoinListMapFs b a count :: Num a => Semiring b a maxsum :: (Ord a, Num a) => Semiring a (AddIdentity a) maxsumsolution :: (Ord a, Num a) => Semiring a (AddIdentity a, Bag (JoinList a)) maxsumWith :: (Ord a, Num a) => (b -> a) -> Semiring b (AddIdentity a) maxsumKWith :: (Ord a, Num a) => Int -> (b -> a) -> Semiring b ([AddIdentity a]) maxsumsolutionXKWith :: (Ord a, Num a) => Semiring c b -> Int -> (c -> a) -> Semiring c [(AddIdentity a, b)] maxsumsolutionXWith :: (Ord a, Num a) => Semiring c b -> (c -> a) -> Semiring c (AddIdentity a, b) maxsumsolutionWith :: (Ord a, Num a) => (b -> a) -> Semiring b (AddIdentity a, Bag (JoinList b)) maxsumsolutionKWith :: (Ord a, Num a) => Int -> (b -> a) -> Semiring b [(AddIdentity a, Bag (JoinList b))] maxprodWith :: (Ord a, Num a) => (b -> a) -> Semiring b (AddIdentity a) maxprodKWith :: (Ord a, Num a) => Int -> (b -> a) -> Semiring b ([AddIdentity a]) maxprodsolutionXKWith :: (Ord a, Num a) => Semiring c b -> Int -> (c -> a) -> Semiring c [(AddIdentity a, b)] maxprodsolutionXWith :: (Ord a, Num a) => Semiring c b -> (c -> a) -> Semiring c (AddIdentity a, b) maxprodsolutionWith :: (Ord a, Num a) => (b -> a) -> Semiring b (AddIdentity a, Bag (JoinList b)) maxprodsolutionKWith :: (Ord a, Num a) => Int -> (b -> a) -> Semiring b [(AddIdentity a, Bag (JoinList b))] segsP :: [a] -> Semiring a s -> s initsP :: [a] -> Semiring a s -> s tailsP :: [a] -> Semiring a s -> s subsP :: [a] -> Semiring a s -> s assignsP :: [m] -> [a] -> Semiring (m, a) s -> s crossConcat :: Bag (JoinList a) -> Bag (JoinList a) -> Bag (JoinList a) bagOfSingleton :: a -> Bag (JoinList a) emptyBag :: Bag (JoinList a) bagOfNil :: Bag (JoinList a) bagUnion :: Bag (JoinList a) -> Bag (JoinList a) -> Bag (JoinList a) type Semiring a s = GenericSemiring (JoinListAlgebra a) s instance [overlap ok] GenericSemiringStructure (JoinListAlgebra a0) (JoinList a0) (JoinListMapFs a0) instance [overlap ok] Ord a => Ord (JoinList a) instance [overlap ok] Eq a => Eq (JoinList a) instance [overlap ok] Read a => Read (JoinList a) instance [overlap ok] Show a => Show (JoinList a)