[Haskell-cafe] Data.Binary Endianness

Don Stewart dons at galois.com
Mon Sep 10 13:25:41 EDT 2007


sven.panne:
> On Monday 10 September 2007 18:21, Thomas Schilling wrote:
> > On Mon, 2007-09-10 at 18:11 +0200, Sven Panne wrote:
> > [...]
> > > The library looks quite nice, but I'm missing support for reading/writing
> > > Int{8,16,32,64}
> >
> > maybe this?
> >
> > http://hackage.haskell.org/packages/archive/binary/0.3/doc/html/Data-Binary
> >-Get.html#v%3AgetWord8
> 
> Of course I can *implement* everything on top of this, but this is not the 
> point. The binary library should have builtin support for more data types, 
> and this is probably not hard to implement.

Yeah, just send patches against the darcs repo for either Binary instances for more 
basic types, or primops if necessary (e.g. for Float)

> 
> > Also note that many Haskell standard types are instances of the Binary
> > class.  I might have misunderstood what you're asking for, though...
> 
> Again a confusion of the 2 things the binary package offers (I was confused 
> initially as well): The Binary class is totally useless for reading/writing 
> existing formats, simply because that's not its task. To read/write an 
> existing format (BMP, MP3, WAV, Quake BSP, etc.) you have to use the 
> getFoo/readFoo functions. So what I was asking for is:
> 
>    getInt32be, putIEEEFloatLe, getIEEEDoubleHost, ...

Right.

> 
> Type classes might be used to get a slightly smaller API, but I am unsure 
> about the performance impact and how much this would really buy us in terms 
> of the ease of use of the API.

Yeah, performance is the big thing here: we spent weeks cranking it up to
hundred+ M/sec throughput. I'd hate to lose that, and the API is pretty simple anyway.

-- Don


More information about the Haskell-Cafe mailing list