how to write a pipes Consumer which return a final state

Hello, I try to create a pipes which return at the end a Cube. the process is quite simple 1) extract data from a file 2) comput a cube of data from these data 3) accumulate these cube during the process 4) when there is no more cube return the final cube I am trying for now to write the part with the 'state' which is hiden in a recursion like this. accumulateP :: (MonadIO m, Shape sh) => Cube sh -> Consumer (DataFrameSpace sh) m (Cube sh) accumulateP cube = do s <- await accumulateP =<< (liftIO $ addSpace s cube) the add Space method return the modified Cube At some point I should see that await can not return a value and I would decide to return the value instead of doing another loop My question is how do I stop this recursion and return the final cube ? thanks for your help.
participants (1)
-
PICCA Frederic-Emmanuel