getting a Binary module into the standard libs

Alastair Reid alastair@reid-consulting-uk.ltd.uk
11 Nov 2002 17:41:51 +0000


> It might be wise also to add a function like:

>   flushByte :: BinHandle -> IO ()

Interfaces to other things with alignment constraints (e.g., memory
allocators) often have one of two generalizations:

1) (Most likely to be useful):

   --| flushBytes h n aligns the strean to the next 2^n byte (bit?) boundary
   flushBytes :: BinHandle -> Int -> IO ()

2) (Less likely to be useful in this context)

   --| flushBytes h m n aligns the stream such that the position p satisfies:
   --  p `mod` 2^m == n
   flushBytes :: BinHandle -> Int -> IO ()

I'd guess that the former could be useful and that the latter is
excessive for this case.

--
Alastair