[Haskell-cafe] Data.Binary suboptimal instance

Andrew Coppin andrewcoppin at btinternet.com
Fri May 22 16:23:04 EDT 2009

Henning Thielemann wrote:
> On Fri, 22 May 2009, Andrew Coppin wrote:
>> My first problem was quite simple. I want to write a program that 
>> reads an item from the input file, processes it, writes it to the 
>> output file, and repeats until the input file is empty. Data.Binary 
>> doesn't appear to provide any obvious way to do this. You can't be in 
>> the Get and Put monads simultaneously, and I can't figure out how to 
>> interleave them.
> You can! - It's again time to point out that Put shouldn't be a monad, 
> but a monoid. But as it is, Put is a Writer monad on top of the 
> Builder monoid. Better use that Builder monoid directly.

Aaaahhhahaha.... Nice.

Thanks for the tip. :-D

More information about the Haskell-Cafe mailing list