We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83a570a commit b81997fCopy full SHA for b81997f
src/HaskellWorks/Data/Streams/Stream.hs
@@ -102,10 +102,10 @@ repeat :: Int -> a -> Stream a
102
repeat n a = Stream step n 1
103
where step i = if i > 0 then Yield a (i - 1) else Done
104
105
-transcribe :: (s -> a -> b) -> s -> Stream a -> Stream b
+transcribe :: (s -> a -> (b, s)) -> s -> Stream a -> Stream b
106
transcribe f w (Stream step state size) = Stream step' (state, w) size
107
where step' (t, x) = case step t of
108
- Yield a s' -> let z = f x a in Yield z (s', x)
+ Yield a s' -> let (z, y) = f x a in Yield z (s', y)
109
Skip s' -> Skip (s', x)
110
Done -> Done
111
{-# INLINE step' #-}
0 commit comments