1 line simple cat in Haskell

Ahn Ki-yung kyagrd@bawi.org
Wed, 13 Nov 2002 15:29:53 +0900

If you are steaming with compicated codes, then how about taking a break.
Let's play with a simple cat.


main = mapM (>>=putChar) getCharS where getCharS = getChar:getCharS


Tested with ghc.
Works good except that you get some messages on stderror
because eof is not handled.

How would you suggest to neatly insert the error handling code into ?

Instead of coding with C++,
I want to write my server main code like this.

server_main = mapM (>>=process.reply) where getReqS = getReq:getReqS

Only if I had enough time ... :-p
Using HDirect and so on ...

Ahn Ki-yung