Haskell IO:无法将类型“IO”与“[]”匹配

Haskell IO: Couldn't match type `IO' with `[]'

playerInstruction :: [String] -> Int -> [String]
playerInstruction mapList count = do
    if count == 0
        then printf "First direction : "
        else printf "Next direction : "
    inp <- getLine
    case inp of
        "Up" -> instructionProc mapList Up
        "Down" -> instructionProc mapList Down
        "Left" -> instructionProc mapList Leftx
        "Right" -> instructionProc mapList Rightx
        otherwise -> playerInstruction mapList count

这是我正在处理的项目代码的一部分。这是一个接受玩家指令并将玩家重定向到另一个功能的功能。 mapList 是一个字符串列表,应该包含地图的逐步变化。 count是统计玩家输入指令数的变量。我遇到的问题是编译器说的是行

inp <- getLine

有错误。带有主题中所述的消息。我不确定如何解决这个问题。如果您想了解有关此项目的更多信息,请随时查看 link: 。谢谢。

您需要在签名中将函数声明为IO

playerInstruction :: [String] -> Int -> IO [String]