问题描述
我有一个导入System.Directory的小程序。当我在命令行上使用runhaskell运行它时,它会编译并输出我期望的结果。
当我在堆栈中使用相同的程序时,
我不明白为什么它能与 runhaskell
但不是当我使用 stack ghci
我认为你有目录$ c
runhaskell myscript.hs
如果您使用 stack
,您可以选择以下选项。 $ b
-
创建一个cabal包,将
目录
添加到build depends部分,创建一个堆栈.yaml
并在项目目录中运行stack ghci
。 使用
stack ghci --package = directory myscript.hs
I am little confused about why this doesn't work.
I have a small program that import System.Directory. When I run it with runhaskell on the command line it compiles and outputs what I expect.
When I use the same program with stack I get a message saying
I dont understand why it would work with runhaskell
but not when i use stack ghci
With the information you give, I can only attempt a guess…
I think you have directory
(globally) installed with cabal install directory
or as a system package - this would explain runhaskell myscript.hs
working.
if you use stack
you have the following options.
make a cabal package, add
directory
to the build depends section, create astack.yaml
and runstack ghci
inside the project directory.use
stack ghci --package=directory myscript.hs
这篇关于我不能在使用堆栈时导入System.Directory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!