--- | Find a WavPack block in a given stream. Returns 'S.Nothing' if no
--- blocks are found.
-findNextBlock ∷ L.ByteString -- ^ the input
- → (# S.Maybe Block, L.ByteString #) -- ^ the rest of input
+-- | Read WavPack blocks in a given stream lazily.
+readBlocks ∷ L.ByteString → [Block]
+readBlocks src
+ = case findNextBlock src of
+ (# S.Just block, src' #)
+ → block : readBlocks src'
+ (# S.Nothing, _ #)
+ → []
+
+findNextBlock ∷ L.ByteString
+ → (# S.Maybe Block, L.ByteString #)