On Tue, 2011-04-19 at 10:02 -0300, Felipe Almeida Lessa wrote: > > Now, that's what I get from reading the code. I don't remember if it > is explicitly allowed or forbidden for an iteratee to generate > leftovers out of nowhere. My guess is that it doesn't make much sense > to allow it.
For the record: such code is therefore illegal
abab :: Iteratee Char Identity ()
abab = continue parseA
where parseA (Chunks ('a':'b':xs)) = parseA (Chunks xs)
parseA (Chunks ('a':[])) = continue parseB
parseA (Chunks xs@(_:_)) = yield () xs
parseA (Chunks []) = continue parseA
parseA EOF = yield () EOF
parseB (Chunks ('b':xs)) = parseA (Chunks xs)
parseB (Chunks xs@(_:_)) = yield () (a:xs)
parseB (Chunks []) = continue parseB
parseB EOF = yield () ['a']
Regards
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
