[web-devel] [ANNOUNCE] First release of crypto-conduit

Michael Snoyman michael at snoyman.com
Sat Jan 7 20:21:24 CET 2012

On Sat, Jan 7, 2012 at 8:45 PM, Grant <thelff at hotmail.com> wrote:
> So I want to take the sha-1 of the file contents prefixed with a string
> containing the file size (similar to how git hashes files). Is there a nice way
> to compose this without having to create two sources against the same file?
> Thanks,
> Grant

I can think of three approaches that should work:

1. Create a Sink which "forks" its input to two other Sinks (similar
to &&& for Arrow). It would have a type signature like: Sink a m b ->
Sink a m c -> Sink a m (b, c)
2. Create a specialized Sink that will wrap a single sink and add the
byte count of the input stream, eg: Sink ByteString m a -> Sink
ByteString m (Int, a)
3. Use a Conduit that will simply update some mutable variable.

I think (1) is the most generally useful, though (3) would be the
easiest to put together. If you want help implementing any of these
approaches, let me know.


More information about the web-devel mailing list