compdata 0.7 → 0.7.0.1
raw patch · 9 files changed
+28/−29 lines, 9 files
Files
- compdata.cabal +4/−2
- src/Data/Comp/Algebra.hs +3/−6
- src/Data/Comp/Annotation.hs +3/−2
- src/Data/Comp/Automata/Product.hs +4/−0
- src/Data/Comp/Multi/Annotation.hs +3/−4
- src/Data/Comp/MultiParam/Algebra.hs +3/−6
- src/Data/Comp/MultiParam/Annotation.hs +3/−2
- src/Data/Comp/Param/Algebra.hs +2/−4
- src/Data/Comp/Param/Annotation.hs +3/−3
compdata.cabal view
@@ -1,5 +1,5 @@ Name: compdata-Version: 0.7+Version: 0.7.0.1 Synopsis: Compositional Data Types Description: @@ -85,7 +85,9 @@ recursion schemes allow for a higher degree of modularity and make it possible to apply fusion. See /Modular Tree Automata/ (Mathematics of Program Construction, 263-299, 2012,- <http://dx.doi.org/10.1007/978-3-642-31113-0_14>).+ <http://dx.doi.org/10.1007/978-3-642-31113-0_14>) and + /Programming Macro Tree Transducers/ (Workshop on Generic Programming, 61-72,+ 2013, <http://dx.doi.org/10.1145/2502488.2502489>). . Examples of using (generalised) (parametric) compositional data types are
src/Data/Comp/Algebra.hs view
@@ -788,8 +788,7 @@ "appSigFunHom/appSigFunHom" forall (f1 :: SigFun f4 f5) (f2 :: Hom f3 f4) (f3 :: SigFun f2 f3) (f4 :: Hom f1 f2) x. appSigFunHom f1 f2 (appSigFunHom f3 f4 x)- = appSigFunHom f1 (compHom (compHomSigFun f2 f3) f4) x;- #-}+ = appSigFunHom f1 (compHom (compHomSigFun f2 f3) f4) x; #-} {-# RULES "cataM/appHomM" forall (a :: AlgM Maybe g d) (h :: HomM Maybe f g) x.@@ -920,11 +919,9 @@ "appHom/appHomM" forall (a :: Hom g h) (h :: HomM m f g) x.- appHomM h x >>= (return . appHom a) = appHomM (compHomM_ a h) x;- #-}+ appHomM h x >>= (return . appHom a) = appHomM (compHomM_ a h) x; #-} {-# RULES "cata/build" forall alg (g :: forall a . Alg f a -> a) .- cata alg (build g) = g alg- #-}+ cata alg (build g) = g alg #-} #endif
src/Data/Comp/Annotation.hs view
@@ -138,5 +138,6 @@ {-| This function is similar to 'project' but applies to signatures with an annotation which is then ignored. -}-project' :: forall f g f1 a h . (RemA f g, f :<: f1) => Cxt h f1 a -> Maybe (g (Cxt h f1 a))-project' v = liftM remA (project v :: Maybe (f (Cxt h f1 a)))+project' :: (RemA f f', s :<: f') => Cxt h f a -> Maybe (s (Cxt h f a))+project' (Term x) = proj $ remA x+project' _ = Nothing
src/Data/Comp/Automata/Product.hs view
@@ -19,6 +19,10 @@ instance a :< a where pr = id ++instance (a,b) :< (a,b) where+ pr = id+ $(genAllInsts 7) instance (c :< b) => c :< (a,b) where
src/Data/Comp/Multi/Annotation.hs view
@@ -34,8 +34,6 @@ import Data.Comp.Multi.Algebra import Data.Comp.Multi.HFunctor -import Control.Monad- -- | This function transforms a function with a domain constructed -- from a functor to a function with a domain constructed with the -- same functor but with an additional annotation.@@ -71,5 +69,6 @@ -- | This function is similar to 'project' but applies to signatures -- with an annotation which is then ignored.-project' :: forall s s' f h a i . (RemA s s', s :<: f) => Cxt h f a i -> Maybe (s' (Cxt h f a) i)-project' v = liftM remA (project v :: Maybe (s (Cxt h f a) i))+project' :: (RemA f f', s :<: f') => Cxt h f a i -> Maybe (s (Cxt h f a) i)+project' (Term x) = proj $ remA x+project' _ = Nothing
src/Data/Comp/MultiParam/Algebra.hs view
@@ -325,8 +325,7 @@ cata a (appHom h x) = cata (compAlg a h) x; "appHom/appHom" forall (a :: Hom g h) (h :: Hom f g) x.- appHom a (appHom h x) = appHom (compHom a h) x;- #-}+ appHom a (appHom h x) = appHom (compHom a h) x; #-} {- {-# RULES @@ -337,13 +336,11 @@ cataM a (appHom h x) = cataM (compAlgM' a h) x; "appHomM/appHomM" forall (a :: HomM m g h b) (h :: HomM m f g b) x.- appHomM h x >>= appHomM a = appHomM (compHomM a h) x;- #-}+ appHomM h x >>= appHomM a = appHomM (compHomM a h) x; #-} {-# RULES "cata/build" forall alg (g :: forall a . Alg f a -> a) .- cata alg (build g) = g alg- #-}+ cata alg (build g) = g alg #-} -} #endif -}
src/Data/Comp/MultiParam/Annotation.hs view
@@ -76,5 +76,6 @@ {-| This function is similar to 'project' but applies to signatures with an annotation which is then ignored. -}-project' :: forall s s' f a b i h . (RemA s s', s :<: f) => Cxt h f a b i -> Maybe (s' a (Cxt h f a b) i)-project' v = liftM remA (project v :: Maybe (s a (Cxt h f a b) i))+project' :: (RemA f f', s :<: f') => Cxt h f a b i -> Maybe (s a (Cxt h f a b) i)+project' (In x) = proj $ remA x+project' _ = Nothing
src/Data/Comp/Param/Algebra.hs view
@@ -826,8 +826,7 @@ "appSigFunHom/appSigFunHom" forall (f1 :: SigFun f4 f5) (f2 :: Hom f3 f4) (f3 :: SigFun f2 f3) (f4 :: Hom f1 f2) x. appSigFunHom f1 f2 (appSigFunHom f3 f4 x)- = appSigFunHom f1 (compHom (compHomSigFun f2 f3) f4) x;- #-}+ = appSigFunHom f1 (compHom (compHomSigFun f2 f3) f4) x; #-} {-# RULES "cataM/appHomM" forall (a :: AlgM Maybe g d) (h :: HomM Maybe f g) x.@@ -958,7 +957,6 @@ "appHom/appHomM" forall (a :: Hom g h) (h :: HomM m f g) x.- appHomM h x >>= (return . appHom a) = appHomM (compHomM_ a h) x;- #-}+ appHomM h x >>= (return . appHom a) = appHomM (compHomM_ a h) x; #-} #endif -}
src/Data/Comp/Param/Annotation.hs view
@@ -74,6 +74,6 @@ {-| This function is similar to 'project' but applies to signatures with an annotation which is then ignored. -}-project' :: forall s s' f h a b . (RemA s s', s :<: f) => - Cxt h f a b -> Maybe (s' a (Cxt h f a b))-project' v = liftM remA (project v :: Maybe (s a (Cxt h f a b)))+project' :: (RemA f f', s :<: f') => Cxt h f a b -> Maybe (s a (Cxt h f a b))+project' (In x) = proj $ remA x+project' _ = Nothing