我可以使用cabal构建和运行一个简单的Haskell程序。
当不需要任何参数时,一切都很顺利。
似乎可以向程序传递参数:
然而,我似乎无法让它正常工作。
module Main where
import System.Environment ( getArgs )
main :: IO ()
main = do
-- (input:_:_) <- getArgs
print "Hello Oren"
当不需要任何参数时,一切都很顺利。
$ cabal build 1>/dev/null 2>/dev/null
$ cabal run
Up to date
"Hello Oren"
似乎可以向程序传递参数:
$ cabal run --help | sed -n '13,16p'
Extra arguments can be passed to the program, but use '--' to separate
arguments for the program from arguments for cabal. The executable is run in
an environment where it can find its data files inplace in the build tree.
然而,我似乎无法让它正常工作。
$ cabal run -- Oren 13 10
cabal: Cannot run the package Oren, it is not in this project (either directly
or indirectly). If you want to add it to the project then edit the
cabal.project file.