次のコードブロックはなぜですか?
main = do
line <- getLine
if null line
then runTestTT tests
else do
line2 <- getLine
seq::[Int] <- return $ map read $ words line2
print $ process seq
エラーをスローします:
lgis.hs:28:13:
Couldn't match type `()' with `Counts'
Expected type: IO Counts
Actual type: IO ()
In a stmt of a 'do' block: print $ process seq
In the expression:
do { line2 <- getLine;
seq :: [Int] <- return $ map read $ words line2;
print $ process seq }
In a stmt of a 'do' block:
if null line then
runTestTT tests
else
do { line2 <- getLine;
seq :: [Int] <- return $ map read $ words line2;
print $ process seq }
両方にもかかわらず:
main = do
runTestTT tests
と
main = do
line <- getLine
line2 <- getLine
seq::[Int] <- return $ map read $ words line2
print $ process seq
うまくいきますか?