I want calculating hash of http post body and parsing it simultaneously when receiving, so I need a function like this:
unionSinks :: Monad m => Consumer a m r1 -> Consumer a m r2 -> Consumer a m (r1, r2)
unionSinks = ...
sinkBody :: Monad m => FromJSON v => Consumer ByteString m (Digest SHA1, v)
sinkBody = sinkHash `unionSinks` sinkParser json
When I developed image uploading I used passthroughSink
in similar way. But I don't needed the result of conduit, which saves image to file, in this case.
Generally, I know how to implement fork using MVar-like things, but I don't sure that this is optimal solution.