From 1e4663076f67f2208aa54b72b3f6ab0fbdebf423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20B=C3=A4renz?= Date: Wed, 7 Aug 2024 09:18:01 +0200 Subject: [PATCH] Generalize concatS --- automaton/src/Data/Automaton.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/automaton/src/Data/Automaton.hs b/automaton/src/Data/Automaton.hs index f97ddfc6..499d5396 100644 --- a/automaton/src/Data/Automaton.hs +++ b/automaton/src/Data/Automaton.hs @@ -451,8 +451,13 @@ handleAutomaton_ f = Automaton . StreamOptimized.withOptimized f . getAutomaton handleAutomaton :: (Monad m) => (StreamT (ReaderT a m) b -> StreamT (ReaderT c n) d) -> Automaton m a b -> Automaton n c d handleAutomaton f = Automaton . StreamOptimized.handleOptimized f . getAutomaton --- | Buffer the output of an automaton. See 'Data.Stream.concatS'. -concatS :: (Monad m) => Automaton m () [b] -> Automaton m () b +{- | Buffer the output of an automaton. See 'Data.Stream.concatS'. + +The input for the automaton is not buffered. +For example, if @'concatS' automaton@ receives one input @a@ and @automaton@ produces 10 @b@s from it, +then the next 9 inputs will be ignored. +-} +concatS :: (Monad m) => Automaton m a [b] -> Automaton m a b concatS (Automaton automaton) = Automaton $ Data.Stream.Optimized.concatS automaton -- * Examples