Hi,

I am using "pipes-concurrency" trying to model the following scenario: my 
"source" pipe has type of 

    stream :: Producer InputData (StateT References IO) ()

 where "References" is just a map that I accumulate while streaming the 
source. Then I am following the "broadcast" example from the Tutorial 
attempting to "fork" my flow into two branches:

main = do
  (output1, input1) <- spawn unbounded
  (output2, input2) <- spawn unbounded
  a1 <- async $ do
    execStateT (runEffect $ stream >-> toOutput (output1 <> output2)) 
emptyTables
    performGC
  a2 <- async $ do
    withFile "/tmp/geo/smart-grouping.xml" WriteMode $ \h -> do
      evalStateT (runEffect $ groupSmart (fromInput input1) >-> toHandle h) 
??? -- what to put here?
      hFlush h
    performGC
  a3 <- async $ do
    withFile "/tmp/geo/damnGrouping.xml" WriteMode $ \h -> do
      evalStateT (runEffect $ groupDamn (fromInput input2) >-> toHandle h) 
???
      hFlush h
    performGC
  mapM_ wait [a1,a2,a3]

I would like my branches to use the information from the source's StateT, 
however following the types, it looks like I have to provide each branch 
with the initial (empty?) state.

How do I share the state between the source and the forked branches? Or how 
do I model this situation correctly?

Cheers,
Alexey.

-- 
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