我是 Haskell 的新手,我正在尝试从输入中获取值列表,并从列表中的每一行打印一个项目。
func :: [String] -> IO ()
当列表大小仅为 1 时,我无法弄清楚如何打印列表中的项目。
func [] = return ()
func [x] = return x
尝试编译文件时收到此错误消息:
Couldn't match expected type `()' with actual type `String'
In the first argument of `return', namely `x'
In the expression: return x
我完全迷路了,我尝试过搜索,但什么也没找到。谢谢!