[英]How can I run a Haskell file using window's powershell?
I downloaded chocolatey
and am able to load up ghci
and get prelude on powershell
.我下载了
chocolatey
并且能够加载ghci
并在powershell
上获得前奏。 I then cd into the directory where I have a haskell file I want to run, then I type ghci
and then type:然后我 cd 进入我想要运行的 haskell 文件的目录,然后我输入
ghci
然后输入:
load haskellprogram.hs
but then I get an error about it not being in scope.但后来我收到一个错误,提示它不在范围内。 Is this not how you run a Haskell program?
这不是你运行 Haskell 程序的方式吗?
The GHCi command to load a file is :load
, not load
.加载文件的 GHCi 命令是
:load
,而不是load
。 You should write:你应该写:
:load haskellprogram.hs
The command can also be abbreviated :l
.该命令也可以缩写为
:l
。 You can find more information about the available commands in GHCi by entering :help
.您可以通过输入
:help
找到有关 GHCi 中可用命令的更多信息。 Also note that the prompt shows the modules you have imported;另请注意,提示会显示您已导入的模块;
Prelude
is just the name of the standard library module that gets imported by default. Prelude
只是默认导入的标准库模块的名称。 You can change the prompt with:您可以使用以下命令更改提示:
:set prompt "> "
:set prompt-cont "| "
(Where prompt-cont
is the prompt for multi-line input, using the commands :{
and :}
or the multi-line input mode enabled by :set +m
.) (其中
prompt-cont
是多行输入的提示,使用命令:{
和:}
或:set +m
启用的多行输入模式。)
When you entered load haskellprogram.hs
, it was interpreted as a Haskell expression: (load haskellprogram) . hs
当您输入
load haskellprogram.hs
,它被解释为 Haskell 表达式: (load haskellprogram) . hs
(load haskellprogram) . hs
, which tries to use the (.)
composition operator and three variables load
, haskellprogram
, and hs
that are not defined. (load haskellprogram) . hs
,它尝试使用(.)
组合运算符和三个haskellprogram
变量load
、 haskellprogram
和hs
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.