>>>>> Alexey Raga <alexey.r...@gmail.com> writes:

> I have a stateful consumer, let's say a counter:

> counter :: (Show a) => Consumer a (StateT Integer IO) ()
> counter = do
> x <- await
> lift $ S.modify (+1)
> liftIO $ print $ show x
> counter

> But how do I get the final state from it?

main :: IO ()
main = do
    x <- flip S.execStateT 0 $ runEffect $ each [1,2,3,4,5,6] >-> counter
    print x

John

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to