如何在emacs中运行haskell应用程序 - haskell模式?

Opt*_*ght 3 emacs haskell haskell-platform haskell-mode

helloworld.hs中的代码:

main = do
putStrLn"你好,你叫什么名字?"
name < - getLine
putStrLn("嘿"++名称++",你摇滚!")

终端应用测试:

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/1]编译Main(/home/optimight/helloworld.hs,解释)
好的,模块已加载:Main.
*主要>

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

Nic*_*out 5

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

  • ...在这里找到解决方案http://stackoverflow.com/questions/13213717/function-to-evaluate-haskell-in-ghci-while-editing-source-file-using-emacs (2认同)