这可能有什么问题?我已经尝试了多种解决方案,但最终都会出现'模块'上的错误以及主要后面的=符号.有没有搞错?!?!?!
printTabuleiro :: [[Char]] -> IO()
printTabuleiro [] = []
printTabuleiro (l :lt) = putStr l : printTabuleiro lt
module Main where
main = let
a = ["#####\n","###o##\n"]
in do printTabuleiro a
Run Code Online (Sandbox Code Playgroud)
现在我得到了这个编译错误,我不明白这里的类型匹配问题.顺便说一句,我是相当新的,不习惯功能,请不要把我加入火星.
[1 of 1] Compiling Main ( visualisacao.hs, interpreted )
visualisacao.hs:14:27:
Couldn't match expected type ‘IO ()’ with actual type ‘[IO ()]’
In the expression: putStr l : printTabuleiro lt
In an equation for ‘printTabuleiro’:
printTabuleiro (l : lt) = putStr l : printTabuleiro lt
visualisacao.hs:14:38:
Couldn't match …Run Code Online (Sandbox Code Playgroud)