我正在尝试编写一个函数来逐行读取文件:
readMyFile = do
contents <- readFile "input.txt"
if(null sStringV == True)
then do
let sStringV = lines contents
let sString = head sStringV
let sStringV = tail sStringV
return sString
else do
let sString = head sStringV
let sStringV = tail sStringV
return sString
我将 sStringV 声明为 null
sStringV = null
当我编译此代码时,我收到以下错误。
Couldn't match expected type `[a0]' with actual type `[a1] -> Bool'
In the first argument of `null', namely `sStringV'
In the first argument of `(==)', namely `null sStringV'
In the expression: (null sStringV == True)
我不明白我的问题在哪里...