Reading/Writing Binary Data in Haskell

Gordon James Miller gmiller@bittwiddlers.com
Tue, 8 Jul 2003 22:46:37 -0400


Hello to all,

I'm recently working on doing some atmospheric modelling for my PhD 
thesis work and I've been writing parallel implementations in Java, 
Ruby, and Haskell.  I picked up Haskell as part of the LoTY project and 
was especially impressed by how expressive and clean the code is.  I've 
been quite successful at writing most of my numerical libraries in 
Haskell (typically at a much reduced SLOC) but I'm not butting my head 
against binary data.

I have a large store of data, output by a Fortran model, which 
essentially consists of binary files containing arrays of floating 
point values.  In doing some googling on reading binary data in Haskell 
I've come across some old (> 1 year) references to some mailing list 
discussions on reading binary data.  So given the background I have a 
few questions:

1 - Is there yet a standard, or at least commonly supported by hugs and 
ghc, method for dealing with binary data.

2 - If not, is there a "standard" library that is used to manipulate 
binary data.  I've seen some references to some implementations but 
given that this is being done in my limited spare time (I'm not a full 
time student) I'd rather not spin my wheels on something that's going 
to be dead in a matter of months.

3 - What is the current status of getting binary data into the Haskell 
standard?

I understand that I can write a C extension, but part of my interest in 
Haskell lies in the ability to write scientific software that very 
closely resembles the mathematics that are being modelled.  On that 
note, I'd also be very interested in conversing with people that are 
doing physics modelling (atmospheric dynamics and chemistry is esp. 
interesting) using functional languages.

Thanks!

Gordon Miller
gmiller@bittwiddlers.com