我想实现一个根据性别提出不同问题的功能。但是我没有给它正确的类型。
askDifferentQuestion :: String -> IO String
askDifferentQuestion sex = do
putStrLn "ciao"
main = do
sex <- getLine
askDifferentQuestion sex
如果我执行我得到
test.hs:3:3:
Couldn't match expected type `String' with actual type `()'
Expected type: IO String
Actual type: IO ()
In the return type of a call of `putStrLn'
In a stmt of a 'do' block: putStrLn "ciao"
Failed, modules loaded: none.
为什么我做错了?