OK, well I don't know the Parsec types and function names off the top of my head, but suppose I have the following:

 runParser :: Parser a b -> [a] -> Either ParseError b

 parseHuffmanTable :: [x] -> Parser Word8 (HuffmanTable x)

 parseHuffmanPayload :: HuffmanTable x -> Parser Word8 [x]

 parseRLE :: Parser Word8 [Word8]

Now, if I want to just do without the RLE bit, I can do

 parseHuffman :: [x] -> Parser Word8 x
 parseHuffman xs = do
   table <- parseHuffmanTable xs
   parseHuffmanPayload table

But if I want to add an RLE layer to just the Huffman table... erm... OK, I'm stuck now. :-S

1. How do I run the input through parseRLE and *then* through parseHuffmanTable?

2. How do I get parseHuffmanPayload to continue from where parseRLE left off? (How do I get parseRLE to not parse the entire input, for that matter...)

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to