Re: [Haskell-cafe] Confused about my IterIO code

2011-07-03 Thread John Ky
Thanks David, Right - it invokes its iter repeatedly because mkInumC does that and mkInum is defined as: mkInum = mkInumC id noCtl So to do it all manually is: inumReverseLines :: (Monad m) = Inum L.ByteString L.ByteString m a inumReverseLines = mkInumM $ loop where loop = do eof -

[Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread John Ky
Hi Hakell Cafe, I'm struggling to understand my unambitious IterIO code that somehow manages to work. Basically I run an echo server that is supposed to read from a socket line by line and write back to the socket with all the characters in the line reversed: import Control.Exception import

Re: [Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread Brandon Allbery
On Thu, Jun 30, 2011 at 09:53, John Ky newho...@gmail.com wrote: enum |$ inumReverseLines .| iter inumReverseLines = mkInum $ do   line - lineI   return (L.reverse (L.concat [line, C.pack \n])) No attempt was made to reverse more than one line - at least as far as I can see.  What have I

Re: [Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread dm-list-haskell-cafe
At Thu, 30 Jun 2011 23:53:02 +1000, John Ky wrote: But all I've done is: enum |$ inumReverseLines .| iter inumReverseLines = mkInum $ do   line - lineI   return (L.reverse (L.concat [line, C.pack \n])) mkInum repeatedly invokes its iter argument so as to keep