Skip to content

Commit 75501dc

Browse files
authored
Merge pull request #81 from haskell-streaming/t54
document unintuitive functor/applicative instance of `Stream`
2 parents 386afa4 + 0ac5102 commit 75501dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Streaming/Internal.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ newtype ShowSWrapper = SS (Int -> ShowS)
223223
instance Show ShowSWrapper where
224224
showsPrec p (SS s) = s p
225225

226+
-- | Operates covariantly on the stream result, not on its elements:
227+
--
228+
-- @
229+
-- Stream (Of a) m r
230+
-- ^ ^
231+
-- | `--- This is what `Functor` and `Applicative` use
232+
-- `--- This is what functions like S.map/S.zipWith use
233+
-- @
226234
instance (Functor f, Monad m) => Functor (Stream f m) where
227235
fmap f = loop where
228236
loop stream = case stream of

0 commit comments

Comments
 (0)