summaryrefslogtreecommitdiff
path: root/src/Data/Profunctor/Mapping.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Profunctor/Mapping.hs')
-rw-r--r--src/Data/Profunctor/Mapping.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Data/Profunctor/Mapping.hs b/src/Data/Profunctor/Mapping.hs
index ac903bb..7538fee 100644
--- a/src/Data/Profunctor/Mapping.hs
+++ b/src/Data/Profunctor/Mapping.hs
@@ -24,6 +24,7 @@ module Data.Profunctor.Mapping
) where
import Control.Arrow (Kleisli(..))
+import Data.Bifunctor.Tannen
import Data.Distributive
import Data.Functor.Compose
import Data.Functor.Identity
@@ -90,6 +91,9 @@ instance (Applicative m, Distributive m) => Mapping (Star m) where
map' (Star f) = Star (collect f)
roam f = Star #. genMap f .# runStar
+instance (Functor f, Mapping p) => Mapping (Tannen f p) where
+ map' = Tannen . fmap map' . runTannen
+
wanderMapping :: Mapping p => (forall f. Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t
wanderMapping f = roam ((runIdentity .) #. f .# (Identity .))