我有这样的代码,但这个错误被显示出来,我不知道为什么:我得到一个类型的错误,我不知道为什么
Couldn't match type 'Char' with '[Char]'
Expected type: [String]
Actual type: String
In the return type of a call of 'tarefa'
In the first argument of 'unlines', namely '(tarefa (lines inp))'
In the first argument of 'putStrLn', namely
'(unlines (tarefa (lines inp)))'
main = do inp <- getContents; putStrLn (unlines (tarefa (lines inp)))
tarefa :: [String]-> String
tarefa tab = let board = getBoard tab
valid = valBoard board
ym = length board
xm = length (head board)
(r:p:s) = drop (length board) tab
in if valid/=0 then [show valid]
else if not (coordOK xm ym r)
then [show (ym +1)]
else if not (progOK p)
then [show (ym+2)]
else if s /= []
then [show (ym+3)]
else ["OK"]
unlines有'[String] - > String'类型 – user1937198