Antoine Latter wrote:
getResponse = do
  require 256
  x <- getX
  len <- getWord16be
  y <- getY
  z <- getZ
  require (fromIntegral len * 8)
  a <- getA
  b <- getB
  return $ Response x y z a b c

This looks like code that could be written in applicative style, in which case you could analyze the parser and automatically compute how many bytes are needed, removing the need for explicit calls to require.

Groetjes,

Martijn.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to