1
我想寫一個反轉文本的IO程序,但它不能工作。我試圖調整反轉函數的縮進,但它仍然不起作用。Haskell解析錯誤(可能是不正確的縮進或不匹配的括號)
完整的錯誤信息是:
reverse.hs:11:1: 分析錯誤(可能不正確壓痕或不匹配的括號)
--reverse a file
module Main where
import System.IO
main = do
putStrLn "reading a file..."
theInput <- readFile "input.txt"
writeFile "output.txt" $ reverse` theInput
reverse` :: String -> String
reverse` [] = []
reverse` (_:xs) = reverse xs : _
這是一個嚴重錯誤 – SingleNegationElimination
@IfLoop你的雙關語幾乎沒有功能。 – jozefg
@jozefg你的雙關只是懶惰。 –