[Haskell-cafe] HDF5 binding

Ferenc Wagner wferi at niif.hu
Fri Mar 4 14:25:46 CET 2011

James Andrew Cook <mokus at deepbondi.net> writes:

> What an interesting coincidence, that makes at least three of
> us. Apparently it's an idea whose time has come.
> Mine is also an incomplete low-level binding but is currently under
> semi-active development and I aim to make it cover the entire hdf5.h
> interface.
> If anyone is interested in it I've put it on github at:
> https://github.com/mokus0/bindings-hdf5


This is fairly extensive indeed!  I got nowhere near this, but also took
a somewhat different angle, especially by using StorableArrays for
passing arrays around (I used HDF5 in conjunction with LaPack).  I also
experienced with going a little higher level here and there.  Attributes
aren't implemented yet, because that would require making location ids a
type class.  An unsolved problem is the safe representation of ranks: I
went for generality by using lists for indexing, but it would be nice to
express dimensionality constraints in the types (with sane syntax).
Maybe there's a handy technique for this, I didn't explore the field.
Talking about indexing, choosing Fortran convention seems to be a
mistake in retrospect, but that's no big deal.

I attach my code so you can get a better idea what I'm talking about,
maybe you can find some usable pieces.  Separating the generic hid type
into specific newtypes worked out to some extent, but maybe isn't a good
idea at the lowest level (where the FFI makes it automatic).  I'd need
broader experience with the HDF5 API to tell.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdf5.tgz
Type: application/x-gtar
Size: 14087 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110304/76aa3af5/attachment.tgz>

More information about the Haskell-Cafe mailing list