性別に基づいてさまざまな質問をする機能を実装したいと考えています。ただし、適切なタイプを指定できません。
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.
なぜ私はそれを間違っているのですか?