在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