Thanks David,
mkInum = mkInumC id noCtl
inumReverseLines :: (Monad m) => Inum L.ByteString L.ByteString m ainumReverseLines = mkInumM $ loop whereloop = doeof <- atEOFIunless eof $ doline <- lineIifeed (L.concat [L.reverse line, C.pack "\n"])loop
At Thu, 30 Jun 2011 23:53:02 +1000,
John Ky wrote:mkInum repeatedly invokes its iter argument so as to keep producing
>
> But all I've done is:
>
> enum |$ inumReverseLines .| iter
>
> inumReverseLines = mkInum $ do
> line <- lineI
> return (L.reverse (L.concat [line, C.pack "\n"]))
chunks. If you want to reverse only one line, it might be easiest to
use something along the lines of:
mkInumM $ do
line <- lineI
ifeed (L.reverse (L.concat [line, C.pack "\n"]))
mkInumM is a more manual Inum construction function that doesn't
automatically do things like loop or handle EOF conditions.
David