packages feed

hw-streams 0.0.0.1 → 0.0.0.2

raw patch · 2 files changed

+10/−1 lines, 2 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ HaskellWorks.Data.Streams.Stream: transcribe :: (s -> a -> b) -> s -> Stream a -> Stream b

Files

hw-streams.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           hw-streams-version:        0.0.0.1+version:        0.0.0.2 synopsis:       Primitive functions and data types description:    Primitive functions and data types. category:       Data
src/HaskellWorks/Data/Streams/Stream.hs view
@@ -101,3 +101,12 @@ repeat :: Int -> a -> Stream a repeat n a = Stream step n 1   where step i = if i > 0 then Yield a (i - 1) else Done++transcribe :: (s -> a -> b) -> s -> Stream a -> Stream b+transcribe f w (Stream step state size) = Stream step' (state, w) size+  where step' (t, x) = case step t of+          Yield a s' -> let z = f x a in Yield z (s', x)+          Skip    s' -> Skip (s', x)+          Done       -> Done+        {-# INLINE step' #-}+{-# INLINE transcribe #-}