summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConalElliott <>2012-09-20 22:09:19 (GMT)
committerhdiff <hdiff@luite.com>2012-09-20 22:09:19 (GMT)
commit98e173007af99b7009a4f208f874e7140af218b5 (patch)
tree90784fc3adbb13f45898bf478970798a749eaf8e
parente3a2aedac43703ac54c77a2cc0d10e3a3f2827cd (diff)
version 0.9.40.9.4
-rw-r--r--TypeCompose.cabal2
-rw-r--r--src/Control/Compose.hs15
2 files changed, 13 insertions, 4 deletions
diff --git a/TypeCompose.cabal b/TypeCompose.cabal
index 3cde61b..f38ade2 100644
--- a/TypeCompose.cabal
+++ b/TypeCompose.cabal
@@ -1,5 +1,5 @@
Name: TypeCompose
-Version: 0.9.3
+Version: 0.9.4
Synopsis: Type composition classes & instances
Category: Composition, Control
Description:
diff --git a/src/Control/Compose.hs b/src/Control/Compose.hs
index be140aa..f3100a0 100644
--- a/src/Control/Compose.hs
+++ b/src/Control/Compose.hs
@@ -29,7 +29,7 @@ module Control.Compose
-- * Value transformers
Unop, Binop
-- * Specialized semantic editor combinators
- , result, argument, (~>), (~>*)
+ , result, argument, (~>), (~>*), (<~), (*<~)
-- * Contravariant functors
, ContraFunctor(..), bicomap
-- * Unary\/unary composition
@@ -121,6 +121,7 @@ result :: Category (-->) => (b --> b') -> ((a --> b) -> (a --> b'))
result = (.)
infixr 1 ~>, ~>*
+infixl 1 <~, *<~
-- | Add pre- and post processing
(~>) :: Category (-->) =>
@@ -128,6 +129,10 @@ infixr 1 ~>, ~>*
-- (f ~> h) g = h . g . f
f ~> h = result h . argument f
+(<~) :: Category (-->) =>
+ (b --> b') -> (a' --> a) -> ((a --> b) -> (a' --> b'))
+(<~) = flip (~>)
+
-- If I add argument back to DeepArrow, we can get a different generalization:
--
-- (~>) :: DeepArrow (-->) => (a' --> a) -> (b --> b') -> ((a -> b) --> (a' -> b'))
@@ -137,8 +142,12 @@ f ~> h = result h . argument f
(a' -> a) -> (b -> b') -> (p a -> q b) -> (p a' -> q b')
f ~>* g = fmap f ~> fmap g
--- (~>*) could be generalized to other categories (beside functions) if we use a
--- more general Functor, as in the "categories" package.
+(*<~) :: (Functor p, Functor q) =>
+ (b -> b') -> (a' -> a) -> (p a -> q b) -> (p a' -> q b')
+(*<~) = flip (~>*)
+
+-- (~>*) and (*<~) could be generalized to other categories (beside functions)
+-- if we use a more general Functor, as in the "categories" package.
{----------------------------------------------------------
Contravariant functors