[Haskell-cafe] Interpreting fields in a buffer

Mikael Brockman phubuh at phubuh.org
Tue Jan 27 00:05:06 EST 2004


On mån, 2004-01-26 at 12:22 -0500, Gregory Wright wrote:
> Hi Dominic,
> 
> First, thanks to everyone for their help.
> 
> RIght now, I'm leaning toward Dominic's solution of a collection
> of helper functions, but I have the feeling that we should be generating
> them automatically. After all, given a buffer that consists of packed,
> fixed width fields, if we specify a name and width of the field, making
> the helper functions should be straightforward. (I understand the
> network byte order issues. Since I won't always have to examine each
> field, I wasn't going to convert all fields to host byte order, rather 
> only
> convert the ones I needed to examine.)
> 
> It's a little strange that we seem to have to use template haskell or
> some other preprocessor to do this. Rather like using a sledgehammer
> to crack a walnut.
> 
> I'll try to come up with something of general use. I'm very interested 
> to
> see Tom's (de)serialization framework. As long as this problem is going
> to require TH, we may as well solve more than one problem.
> 
> And now I let you return to your discussion of the tab character ;-)
> 
> Best Wishes,
> Greg
> 

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



More information about the Haskell-Cafe mailing list