简体   繁体   English

<interactive> :7:36: 错误:输入`.' 时出现解析错误在命令提示符下使用 haskell ghci 当我的源文件中只有“Hello world”时</interactive>

[英]<interactive>:7:36: error: parse error on input `.' in command prompt using haskell ghci when my source file only has "Hello world" in it

imge of errror错误图片

I'm very new to haskell and the entire installation process was confusing to me.我是 haskell 的新手,整个安装过程让我感到困惑。 I downloaded power shell and then installed chocolatey and haskell. now im putting ghci into my command prompt and trying to run my.hs file.我下载了 power shell,然后安装了 chocolatey 和 haskell。现在我将 ghci 放入命令提示符并尝试运行 my.hs 文件。

In order to load a file, you should work with the :load (or its shortcut :l ) directive, so:为了加载文件,您应该使用:load (或其快捷方式:l )指令,因此:

:load C:\Users\gravon\OneDrive\Desktop\yoo.hs

once you loaded the file, you can run a function, for example a main , given this function is defined in the yoo.hs .加载文件后,您可以运行 function,例如main ,因为 function 在yoo.hs中定义。

You can also work with runhaskell [haskell.org] and thus run a file in the shell with:您还可以使用runhaskell [haskell.org] ,从而运行 shell 中的文件:

$ runhaskell 'C:\Users\gravon\OneDrive\Desktop\yoo.hs'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM