
8 Aug
2011
8 Aug
'11
7:45 a.m.
Sunil S Nandihalli
module Main where import Prelude
stringToInt::String->Int stringToInt str = read str
main = do x<-getLine y<-stringToInt x print y
It is a type problem. Using the '<-' syntax for 'stringToInt' requires that it is a monadic function (like: String -> IO Int), but it is not. Since it is not monadic, you can simply let-bind the result to a name: do xStr <- getLine let x = stringToInt xStr print x Or more simply: do xStr <- getLine print (stringToInt xStr) Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/