Difference between revisions of "Emacs"

From HaskellWiki
Jump to navigation Jump to search
(Added a haskell-emacs section)
(Updated summary)
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
{{Haskell infobox}}
 
{{Haskell infobox}}
   
There are many Emacs packages and modules for Haskell. The most prominent ones are haskell-mode, ghc-mod and Scion.
+
There are many Emacs packages and modules for Haskell. haskell-mode is stable and usable, whereas lsp-haskell is newer but under development and not ready for general use.
   
 
== Newbie guide ==
 
== Newbie guide ==
Line 8: Line 8:
 
Emacs is an extensible texteditor which can be extended with so-called "modes" and makes great use of keystrokes. Modes are written in Emacs Lisp (.el) programming language and provide additional commands and keystrokes. A mode is usually activated automatically via "hooks" based on file extensions (.hs, .cabal etc.) but can also be loaded during Emacs startup (~/.emacs) or in Emacs itself (enter: M-x haskell-mode). None of the modes listed below provide a complete out-of-the-box IDE; rather, each adds only a set of functionality specific to that mode. Note also that each mode must be installed separately. Lookup the specific help files to find out what each of them provide. To test if haskell-mode is actually installed type: M-x haskell-<tab>. You should get a list of commands. Entering "haskell-mode" provides additional commands. Try "haskell-version" for example.
 
Emacs is an extensible texteditor which can be extended with so-called "modes" and makes great use of keystrokes. Modes are written in Emacs Lisp (.el) programming language and provide additional commands and keystrokes. A mode is usually activated automatically via "hooks" based on file extensions (.hs, .cabal etc.) but can also be loaded during Emacs startup (~/.emacs) or in Emacs itself (enter: M-x haskell-mode). None of the modes listed below provide a complete out-of-the-box IDE; rather, each adds only a set of functionality specific to that mode. Note also that each mode must be installed separately. Lookup the specific help files to find out what each of them provide. To test if haskell-mode is actually installed type: M-x haskell-<tab>. You should get a list of commands. Entering "haskell-mode" provides additional commands. Try "haskell-version" for example.
   
== Haskell-mode ==
+
== Active projects ==
  +
  +
=== Spacemacs ===
  +
  +
[http://spacemacs.org/ spacemacs] is an Emacs distribution.
  +
  +
It provides a [http://spacemacs.org/layers/+lang/haskell/README.html Haskell development layer] which integrates and combines many of the Emacs-Haskell-packages, like auto-completion from ghc-mod, linting, hoogle and more.
  +
  +
=== Haskell-mode ===
   
 
The <code>haskell-mode</code> package is a set of major modes for Emacs for writing Haskell code and working with Haskell projects. Features syntax highlighting, intelligent indentation, interaction with inferior Haskell interpreter, code browsing, and Cabal project integration. It support Hugs, GHCi, Cabal and hslint, hoogle, cabal-dev, and other utilities.
 
The <code>haskell-mode</code> package is a set of major modes for Emacs for writing Haskell code and working with Haskell projects. Features syntax highlighting, intelligent indentation, interaction with inferior Haskell interpreter, code browsing, and Cabal project integration. It support Hugs, GHCi, Cabal and hslint, hoogle, cabal-dev, and other utilities.
Line 16: Line 24:
 
Since 10th May 2014, there is extensive [https://github.com/haskell/haskell-mode/wiki documentation for emacs haskell-mode on github].
 
Since 10th May 2014, there is extensive [https://github.com/haskell/haskell-mode/wiki documentation for emacs haskell-mode on github].
   
== Scion ==
+
=== lsp-haskell ===
  +
[https://github.com/emacs-lsp/lsp-haskell lsp-haskell] is a Language Server Protocol implementation for Haskell, which can interact with haskell-ide-engine.
   
 
=== tmux GHCI control ===
The [http://code.google.com/p/scion-lib/ Scion IDE library] can be used to complement the haskell-mode with additional features, such as (quoting the documentation):
 
  +
 
Emacs can also control a GHCI repl running in a [http://tmux.sourceforge.net tmux] window. Libraries such as [http://github.com/jfeltz/emamux-ghci emamux-ghci] have been written to simplify doing that.
  +
 
=== haskell-emacs ===
  +
 
[https://github.com/knupfer/haskell-emacs haskell-emacs] is a library which allows extending Emacs in Haskell. It provides an FFI (Foreign Function Interface) for Haskell functions.
  +
  +
== Unsupported projects ==
  +
 
=== Scion ===
  +
'''No longer being updated'''
  +
 
The [https://github.com/nominolo/scion Scion IDE library] can be used to complement the haskell-mode with additional features, such as (quoting the documentation):
   
 
* Highlights error messages directly in the source, together with a tool-tip
 
* Highlights error messages directly in the source, together with a tool-tip
Line 27: Line 49:
 
Documentation on how to use `scion.el` can be found in the `README.markdown` file.
 
Documentation on how to use `scion.el` can be found in the `README.markdown` file.
   
The primary repository is at [https://github.com/nominolo/scion nominolo/scion]. An experimental fork featuring GHC7 support can be found at [https://github.com/hvr/scion hvr/scion]. The hackage version is probably outdated, so better use the upstream version.
+
The primary repository is at [https://github.com/nominolo/scion nominolo/scion]. An experimental fork featuring GHC7 support can be found at [https://github.com/hvr/scion hvr/scion].
   
== ghc-mod ==
+
=== ghc-mod ===
  +
'''No longer provides a supported IDE'''
   
 
"ghc-mod" is a backend command to enrich Haskell programming on editors including Emacs and Vim. The ghc-mod package on Hackage includes the "ghc-mod" command and Emacs front-end. Its source repository is on github.
 
"ghc-mod" is a backend command to enrich Haskell programming on editors including Emacs and Vim. The ghc-mod package on Hackage includes the "ghc-mod" command and Emacs front-end. Its source repository is on github.
Line 37: Line 60:
 
See [http://www.mew.org/~kazu/proj/ghc-mod/en/ the home page] for more information.
 
See [http://www.mew.org/~kazu/proj/ghc-mod/en/ the home page] for more information.
   
== Hugs mode ==
+
=== Hugs mode ===
   
Alternative [http://www.haskell.org/libraries/hugs-mode.el Hugs Mode for Emacs] by Chris Van Humbeeck provides fontification and cooperation with Hugs. Updated for emacs 20.* by Adam P. Jenkins.
+
Alternative Hugs Mode for Emacs by Chris Van Humbeeck provides fontification and cooperation with Hugs. Updated for emacs 20.* by Adam P. Jenkins.
 
== tmux GHCI control ==
 
 
Emacs can also control a GHCI repl running in a [http://tmux.sourceforge.net tmux] window. Libraries such as [http://github.com/jfeltz/emamux-ghci emamux-ghci] have been written to simplify doing that.
 
 
== LaTeX ==
 
 
[http://daniel.franke.name/latex-lhs-mode.el latex-lhs-mode.el] is built on top of haskell-mode (above) and provides simultaneous use of all of literate-haskell-mode and most of emacs' built-in latex-mode.
 
 
== Cabal ==
 
 
[http://mapcar.org/haskell/cabal-mode/ cabal-mode.el] is a small (and developing) major mode for editing Cabal files.
 
 
== haskell-emacs ==
 
 
[https://github.com/knupfer/haskell-emacs haskell-emacs] is a library which allows extending Emacs in Haskell. It provides an FFI (Foreign Function Interface) for Haskell functions.
 

Revision as of 09:42, 22 February 2020

Emacs for Haskell

Inferior Haskell processes
Automatic unit testing
Automatic building
API searching
Project navigation
Snippets
Literate programming

There are many Emacs packages and modules for Haskell. haskell-mode is stable and usable, whereas lsp-haskell is newer but under development and not ready for general use.

Newbie guide

Emacs is an extensible texteditor which can be extended with so-called "modes" and makes great use of keystrokes. Modes are written in Emacs Lisp (.el) programming language and provide additional commands and keystrokes. A mode is usually activated automatically via "hooks" based on file extensions (.hs, .cabal etc.) but can also be loaded during Emacs startup (~/.emacs) or in Emacs itself (enter: M-x haskell-mode). None of the modes listed below provide a complete out-of-the-box IDE; rather, each adds only a set of functionality specific to that mode. Note also that each mode must be installed separately. Lookup the specific help files to find out what each of them provide. To test if haskell-mode is actually installed type: M-x haskell-<tab>. You should get a list of commands. Entering "haskell-mode" provides additional commands. Try "haskell-version" for example.

Active projects

Spacemacs

spacemacs is an Emacs distribution.

It provides a Haskell development layer which integrates and combines many of the Emacs-Haskell-packages, like auto-completion from ghc-mod, linting, hoogle and more.

Haskell-mode

The haskell-mode package is a set of major modes for Emacs for writing Haskell code and working with Haskell projects. Features syntax highlighting, intelligent indentation, interaction with inferior Haskell interpreter, code browsing, and Cabal project integration. It support Hugs, GHCi, Cabal and hslint, hoogle, cabal-dev, and other utilities.

Haskell-mode is maintained by Philip Weaver. The official project is hosted on Github. For instructions on installing, see Installing haskell-mode. Issues should be reported to the Github project. Please state the version of Emacs and any relevant configuration, when writing your issue. There is a low traffic mailing list, too. Generally it is responsive to new posts.

Since 10th May 2014, there is extensive documentation for emacs haskell-mode on github.

lsp-haskell

lsp-haskell is a Language Server Protocol implementation for Haskell, which can interact with haskell-ide-engine.

tmux GHCI control

Emacs can also control a GHCI repl running in a tmux window. Libraries such as emamux-ghci have been written to simplify doing that.

haskell-emacs

haskell-emacs is a library which allows extending Emacs in Haskell. It provides an FFI (Foreign Function Interface) for Haskell functions.

Unsupported projects

Scion

No longer being updated

The Scion IDE library can be used to complement the haskell-mode with additional features, such as (quoting the documentation):

  • Highlights error messages directly in the source, together with a tool-tip
  • Optional on-the-fly typechecking (idle-time based, or whenever file is saved)
  • Completion on `LANGUAGE` names, pragmas, external module names and `OPTIONS`-flags
  • Go to definition sites of symbols at point

Documentation on how to use `scion.el` can be found in the `README.markdown` file.

The primary repository is at nominolo/scion. An experimental fork featuring GHC7 support can be found at hvr/scion.

ghc-mod

No longer provides a supported IDE

"ghc-mod" is a backend command to enrich Haskell programming on editors including Emacs and Vim. The ghc-mod package on Hackage includes the "ghc-mod" command and Emacs front-end. Its source repository is on github.

Emacs front-end is an extension of Haskell mode. They enable to complete Haskell symbols on Emacs and to browse documents of modules. Flymake with GHC/Hlint is also integrated.

See the home page for more information.

Hugs mode

Alternative Hugs Mode for Emacs by Chris Van Humbeeck provides fontification and cooperation with Hugs. Updated for emacs 20.* by Adam P. Jenkins.