Emacs中的`haskell-compile`用于单元测试。

huangapple go评论67阅读模式
英文:

Emacs `haskell-compile` for unit tests

问题

  1. 如果我需要运行 cabal test 怎么办?
  2. 如果我需要运行 cabal run 怎么办?
英文:

Emacs newbie here, transitioning from Neovim.
I have a project in Haskell, and I am aware that I can run haskell-compile and it will execute cabal build. 2 questions please:

  1. What can I do if I need cabal test?
  2. What can I do if I need cabal run?

答案1

得分: 0

以下是您要翻译的内容:

对于未来的谷歌搜索用户,这是我采用的解决方案:

  (general-nmap haskell-mode-map
    "<leader>b" '(lambda ()
                  (interactive)
                  (save-some-buffers t)
                  (setq-local haskell-compile-cabal-build-command "cabal build")
                  (haskell-compile)))

  (general-nmap haskell-mode-map
    "<leader>t" '(lambda ()
                  (interactive)
                  (save-some-buffers t)
                  (setq-local haskell-compile-cabal-build-command "cabal test")
                  (haskell-compile)))
英文:

For future googlers, here is the solution I adopted:

  (general-nmap haskell-mode-map
    &quot;&lt;leader&gt;b&quot; &#39;(lambda ()
                  (interactive)
                  (save-some-buffers t)
                  (setq-local haskell-compile-cabal-build-command &quot;cabal build&quot;)
                  (haskell-compile)))

  (general-nmap haskell-mode-map
    &quot;&lt;leader&gt;t&quot; &#39;(lambda ()
                  (interactive)
                  (save-some-buffers t)
                  (setq-local haskell-compile-cabal-build-command &quot;cabal test&quot;)
                  (haskell-compile)))

huangapple
  • 本文由 发表于 2023年5月21日 02:53:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76296877.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定