[Haskell-cafe] binary IO

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Dec 27 01:00:12 EST 2005


On Tue, Dec 27, 2005 at 01:10:24AM -0300, Pupeno wrote:
> It seems I have found a hole in Haskell... :(

I don't think so. Even if there was no way to do this, you could fill
the hole yourself.

> Before I start to develop a library with functions such us those on 
> http://haskell.org/hawiki/BinaryIo (hGetWord8, hGetWord16le, hGetWord16be, 
> etc), is there some reliable library that can help me ?
> I basically need a set of functions to read binary data out of a Handle (a 
> higher lever of hGetBuf and hPutBuf). What I am doing is implementing a DNS 
> server, so, my typical need is:

I think in the case of DNS, where the packets are quite small, it's best
to separate reading the Handle from interpreting the data. For example,
you can read from socket to a FastPackedString, and have a purely
functional deserialization code work on it.

Some time ago I was playing with DNS too. I have a library that can
construct and interpret DNS packets, but it's a bit incomplete right
now. It reads packets as Strings, but it should be quite straightforward
to make it read and interpret FastPackedStrings.

    http://www.uncurry.com/repos/TzDNS

I've just glanced at the code, and yes, it is a bit of a mess. I'll see
if I can tidy it up. Perhaps you could help me?

Best regards
Tomasz

-- 
I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland


More information about the Haskell-Cafe mailing list