嗨,抱歉在這裏轉儲錯誤消息,但我嘗試了所有可以找到的東西,而且沒有任何相關性。此代碼正在生成錯誤:Haskell:'do'構造中的最後一個語句必須是一個表達式
import System.Environment
import System.Directory
import System.IO
import Data.List
data Node = PathNode String Float Float [String] | NoNode deriving (Show)
main = do
(filename:args) <- getArgs
load filename
load :: String -> IO()
load fileName = do
contents <- readFile fileName
let pathStrings = lines contents
first = head pathStrings
args = lines first
path = createNode args
putStr path
createNode [String] -> Node
createNode (name:x:y:paths) = PathNode name x y paths
createNode [] = NoNode
我知道它與對齊方式有關,但我已正確調整了「加載」函數中的所有調用。我究竟做錯了什麼?
感謝 -A
參見http://stackoverflow.com/questions/4513396/problem-with-do-construct-in-haskell – 2011-05-04 16:50:17