Hi peeps ! I got a serious problem here :-) .......................................................... main = withSocketsDo ( do socket <- listenOn (PortNumber 9900) print "Server online" loop socket) loop socket = do (handling, host, port) <- accept socket forkIO (client handling) loop socket client handling = do anfrage <- hGetLine handling -- HERE ! let anfrage2 = umwandlungder anfrage ergebnis <- resultOrError (proofEngine anfrage2) let endergebnis = teste ergebnis hPutStr handling endergebnis hClose handling ............................................................................ IŽm using hGetLine at the mom, but I need to use hGetChar for further editing in this prog. Since I ainŽt really into haskell, I mailed you. This Prog is supposed to get a String of following form: "STRING 3 a&b" or "STRING 5 a & b" So, I suggest when reading the chars in loop, I need a Escape Character...How would you solve this ? Thx, Tobe -- Best regards, Tobe mailto:tobe@playahs.de
On 5/10/05, Tobe <tobe@playahs.de> wrote:
Hi peeps !
I got a serious problem here :-) .......................................................... main = withSocketsDo ( do socket <- listenOn (PortNumber 9900) print "Server online" loop socket)
loop socket = do (handling, host, port) <- accept socket forkIO (client handling)
loop socket
client handling = do
anfrage <- hGetLine handling -- HERE ! let anfrage2 = umwandlungder anfrage
ergebnis <- resultOrError (proofEngine anfrage2) let endergebnis = teste ergebnis
hPutStr handling endergebnis hClose handling ............................................................................ IŽm using hGetLine at the mom, but I need to use hGetChar for further editing in this prog. Since I ainŽt really into haskell, I mailed you. This Prog is supposed to get a String of following form: "STRING 3 a&b" or "STRING 5 a & b" So, I suggest when reading the chars in loop, I need a Escape Character...How would you solve this ?
Thx, Tobe
-- Best regards, Tobe mailto:tobe@playahs.de
This seems to be a similar issue: http://comments.gmane.org/gmane.comp.lang.haskell.cafe/6658 Basically, read the text then do some higher level parsing of it... Don't read one char at a time in a loop.. Do your logic at a higher abstraction... /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862
participants (2)
-
Sebastian Sylvan -
Tobe