Next: , Previous: , Up: Top   [Index]


4 Editing Haskell Code

Haskell Mode is actually a collection of so-called major modes1 one of which is called haskell-mode. To avoid confusion, when referring to this package the name “Haskell mode” is written in a normal font, whereas when referring the major mode of the same name haskell-mode written with a dash in-between in a typewriter font is used.

As one might guess, haskell-mode is the (programming language2) major mode for editing (non-literate) Haskell source code. haskell-mode is associated with the file extensions listed below by default3.

.hs

official file extension for (non-literate) Haskell 98/2010 files

.hsc

“almost-Haskell” input file for the hsc2hs pre-processor

.cpphs

input file for the cpphs pre-processor

The major mode literate-haskell-mode (which is derived from haskell-mode and thus transitively from prog-mode) provides support for literate Haskell programs and is associated with the .lhs file extension by default.

literate-haskell-mode supports Bird-style as well as TeX-style literate Haskell files. The currently detected literate Haskell variant is shown in the mode line (see (emacs)Mode Line) as either ‘LitHaskell/bird’ or ‘LitHaskell/tex’.

4.1 Font Lock Support

haskell-mode supports syntax highlighting via Emacs’ Font Lock minor mode which should be enabled by default in current Emacsen. See (emacs)Font Lock, for more information on how to control font-lock-mode.


Footnotes

(1)

for more information about the concept of major modes see (emacs)Major Modes

(2)

haskell-mode is derived from prog-mode

(3)

for more information about file associations, see (emacs)Choosing Modes