[Haskell-cafe] Interpreting fields in a buffer

Jeremy Shaw jeremy.shaw at lindows.com
Tue Jan 27 12:08:06 EST 2004


Hello,

I just wanted to chime in with a 'me too' in regards to this whole
thread. Many of the programs I want to write involve reading and
writing binary file formats, and writing the code to actually do that
tends to be the ugliest, most error prone, boring part of the whole
program.

I have not thought to hard about the problem yet, but it seems like in
addition to having low-level support for reading binary structures, it
might be nice to have some sort of high-level syntax that could be
used to autogenerate helper functions.

It would be nice if I could write in some sort of syntax, what the
binary file format looked like. Then something would read the format
description, and generate a bunch of useful functions.

For example, maybe it would generate a function that parses a binary
file into an algebraic data structure, a function to validates an
algebraic data structure, and function that writes the structure back
out.

I think, actually, that this could be done via template
haskell. (Maybe someone has even done this already...)

In any case, its just a daydream right now as I don't have time to
even think about designing something. :)

Jeremy Shaw.




At Tue, 27 Jan 2004 19:43:48 -0000,
Dominic Steinitz wrote:
> 
> I looked at the Erlang syntax when I wrote my helper functions and I agree
> it is very nifty. I didn't have the time to investigate how to do it in
> Haskell but it would be disappointing if it (or something like it) couldn't
> be done.
> 
> Dominic.
> 
> >
> > Mikael,
> >
> > Thanks, that's very helpful and seems to be just the sort of
> > thing I'm looking for.
> >
> > Greg
> >
> >
> > On Jan 26, 2004, at 6:05 PM, Mikael Brockman wrote:
> > >
> > > You'll probably want to take a look at Erlang's so called ``bit
> > > syntax''
> > > at http://www.erlang.se/euc/00/bit_syntax.html.  It's very nifty, and
> > > I'd love to see it (or something equally convenient) as a Haskell
> > > extension.
> > >
> > > Hugs and kisses,
> > > Mikael Brockman
> > >
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list