9 May
2010
9 May
'10
10:13 p.m.
On 05/08/10 11:55, Ken Overton wrote:
Sorry for such a beginner-y question, but is there a way to make a function like:
interact :: String -> Resp interact txt = putStrLn txt rsp<- getLine return parseResp rsp
parseResp :: String -> Resp
Or is that simply a wrong way of programming in Haskell with IO?
I think, yes your function looks close to typical Haskell, you're just missing a "do", a pair of parentheses, and an "IO": interact :: String -> IO Resp interact txt = do putStrLn txt rsp <- getLine return (parseResp rsp) parseResp :: String -> Resp Does that make sense to you? Would you like more detailed explanation of the changes? -Isaac