On Fri, Apr 22, 2011 at 5:54 AM, Maciej Marcin Piechotka
<uzytkown...@gmail.com> wrote:
> 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']

Is it really illegal?  I guess you're pointing out a problem with the
last line, because it's EOF and we yield something.  But that
something was given to us in some "continue" step.  IMHO, that's
perfectly fine.  The same thing goes for the other yield in parseB.

Cheers,

-- 
Felipe.

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

Reply via email to