我想讀取一個String和toUpper的所有字符。如何使用從getLine獲取的字符串的映射?[Haskell]
import Data.Char
main = do
a <- getLine
b <- getLine
map toUpper a
if (a == b)
then print 0
else if (a < b)
then print (-1)
else print 1
然後我得到這個
Couldn't match expected type `IO a0' with actual type `[b0]'
In the return type of a call of `map'
In a stmt of a 'do' expression: map toUpper a
In the expression:
do { a <- getLine;
b <- getLine;
map toUpper a;
if (a == b) then
print 0
else
if (a < b) then print (- 1) else print 1 }
侯我可以使用與函數getline有一個字符串映射? 或者還有另一種方式來讀取一個字符串,並上傳所有的字符?
將電梯FX =回報(FX)的函數getline >> =電梯(地圖toUpper) –