snoyberg/conduit — pull request #92 by joeyadams (2013-03-09 09:15:42+00:00)
Title: Data.Conduit.Resumable: resumable sources, sinks, and conduits

This pull request adds a new module, `Data.Conduit.Resumable`. The conduit package already has ResumableSource; this adds ResumableSink and ResumableConduit, with similar interfaces. ResumableSink is heavily inspired by the [conduit-resumablesink package] by Andrew Miller (@A1kmm).

ResumableSink and ResumableConduit both have tests, though they might not be 100% comprehensive. I marked the Data.Conduit.Resumable module "experimental" in case we find a better interface or discover semantic issues with the existing interface.

I did a couple "clumsy" things in the test code:

* Import Data.Conduit, Data.IORef, etc. unqualified.

* Use partial do patterns instead of [shouldBe].

I know this is inconsistent with the existing code, but I left it this way for a philosophical reason: writing tests should first and foremost be easy. It's better to have some tests that produce ugly failure output than it is to not have those tests at all. If a test fails later and we want to know what the failure output was, we can replace partial patterns with [shouldBe] as part of the troubleshooting process.

[1]: http://hackage.haskell.org/package/conduit-resumablesink
[shouldBe]: http://hackage.haskell.org/packages/archive/hspec-expectations/latest/doc/html/Test-Hspec-Expectations.html#v:shouldBe