@@ -34,7 +34,7 @@ where
35import Fusion.Plugin.Types (Fuse(..))
35import Fusion.Plugin.Types (Fuse(..))
36import Streamly.Internal.Data.Stream.StreamD.Step (Step(..))
36import Streamly.Internal.Data.Stream.StreamD.Step (Step(..))
37−import Prelude hiding (concat)
37+import Prelude hiding (concat, map)
39------------------------------------------------------------------------------
39------------------------------------------------------------------------------
@@ -112,6 +112,27 @@ translate f g (Producer step inject extract) =
112lmap :: (a -> a) -> Producer m a b -> Producer m a b
112lmap :: (a -> a) -> Producer m a b -> Producer m a b
113lmap f (Producer step inject extract) = Producer step (inject . f) extract
113lmap f (Producer step inject extract) = Producer step (inject . f) extract
115+------------------------------------------------------------------------------
117+------------------------------------------------------------------------------
119+-- | Map a function on the output of the producer (the type @b@).
122+{-# INLINE_NORMAL map #-}
123+map :: Functor m => (b -> c) -> Producer m a b -> Producer m a c
124+map f (Producer ustep uinject uextract) = Producer step uinject uextract
128+ {-# INLINE_LATE step #-}
129+ step st = fmap (fmap f) (ustep st)
131+-- | Maps a function on the output of the producer (the type @b@).
132+instance Functor m => Functor (Producer m a) where
115------------------------------------------------------------------------------
136------------------------------------------------------------------------------
116-- Nesting
137-- Nesting
117------------------------------------------------------------------------------
138------------------------------------------------------------------------------