嗨,抱歉在这里转储错误消息,但我尝试了所有可以找到的东西,而且没有任何相关性。此代码正在生成错误: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