【发布时间】:2014-08-08 16:56:25
【问题描述】:
我对 Haskell 还很陌生,目前正在做一份暑期作业。我正在尝试将测试文件作为 ghci 命令行中的参数传递到我的 .hs 中。有人可以详细说明这应该如何发生吗?下面是我的 .hs 中的开始代码块,它使用 getArgs 和 readFile 来读取文件并从数据中创建一个元组。
import Prelude
import System.Environment ( getArgs )
import Data.List
import Helpers
-- The main method that will be used for testing / command line access
main = do
args <- getArgs
filename <- readFile (head args)
checkersState <- readonemoveFile filename
当我 :load this .hs 时,我是否将文件作为参数添加到它后面?如:
:load csce322a03p01.hs test01.onemove
我认为不会,因为这会给我一个错误:
target `test01.onemove' is not a module name or a source file
【问题讨论】: