在standalone working script,我有一个函数返回IO()
这样:转换功能,putStrLn'd返回字符串
main :: IO()
main = do
response <- simpleHttp "https://leonstafford.github.io"
let body = decodeUtf8 (response)
let bodyAsString = unpack (body)
putStrLn $ htmlToPlainText bodyAsString
现在我试图利用同样的功能在this existing script,但与普通Couldn't match type ‘[Char]’ with ‘Char’
挣扎:
renderPage :: String -> String
renderPage url = do
response <- simpleHttp url
let body = decodeUtf8 (response)
bodyAsString = unpack (body)
articleAsPlainText = htmlToPlainText bodyAsString
return articleAsPlainText
我一直在摆弄它和关闭了大约一个星期,希望我已经能够在标题足够的定义问题,所以它可能不是另一个can't match expected types
后,虽然上午PRET肯定就是这样。
'renderPage ::字符串 - > IO String' – melpomene
没有这样的运气'预期类型:字符串实际类型: IO字符串' –
您删除了错误消息中最重要的部分:文件名/行号。新的错误发生在哪里? – melpomene