【问题标题】:How to run a haskell application in emacs - haskell mode?如何在 emacs - haskell 模式下运行 haskell 应用程序?
【发布时间】:2012-07-27 08:24:12
【问题描述】:

helloworld.hs 中的代码:

主要=做
putStrLn "你好,你叫什么名字?"
名称 putStrLn ("嘿" ++ name ++ ",你真棒!")

在终端中测试的应用程序:

optimight@optimight:~$ ghc --make helloworld
[1 of 1] 编译 Main (helloworld.hs, helloworld.o)
链接 helloworld ...
optimight@optimight:~$ ./helloworld
你好,请问你叫什么名字?
约翰
嘿,约翰,你摇滚!

在 emacs 中加载的 helloworld.hs - haskell 主要模式:

GHCi,版本 7.4.1:http://www.haskell.org/ghc/:?寻求帮助
加载包 ghc-prim ... 链接 ... 完成。
正在加载包 integer-gmp ... 链接 ... 完成。
正在加载包库...链接...完成。
Prelude> :load "/home/optimight/helloworld.hs"
[1 of 1] 编译 Main(/home/optimight/helloworld.hs,解释)
好的,已加载模块:Main.
*主>

现在,如何(程序是什么?)在emacs-haskell模式环境下测试它?(我相信,当我使用emacs-haskell模式时,应该不需要切换到终端。)

【问题讨论】:

  • 你的问题是如何在emacs下对Haskell使用REPL(read eval print loop)。
  • @Basile Starynkevitch:好的,那么如何在emacs下使用REPL for Haskell?
  • 只需在 Emacs 中的 ghci 提示符处输入 main,或者您想测试的任何函数。

标签: haskell emacs haskell-platform haskell-mode


【解决方案1】:

要执行与您在命令行中执行的操作类似的操作,您需要在 ghci 中加载程序(您已经完成),然后调用 main 方法(您只需在提示)。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-12-19
  • 2011-03-26
  • 2013-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-04
相关资源
最近更新 更多