By scrutinizing the documentation, I have learned that Emacs haskell-mode
ships with three different, mutually exclusive methods of automated indentation. They are called haskell-indentation
, haskell-indent
, and haskell-simple-indent
. Can anyone explain how these methods are similar and how they are different? I am interested not only in individual features but also if one is a de facto standard or if one or two are no longer maintained.

- 198,648
- 61
- 360
- 533
-
1This is not part of the official Emacs distribution. If you don't get an answer here, you may have better luck contacting the author of the package directly. The documentation of these three options could use some expansion. If it's an active project you might submit a bug to that effect. – Tyler Jul 16 '12 at 19:21
3 Answers
Really, as far as I am aware from asking people, there is no de facto standard, people have strong opinions about which they prefer but with little specific evidence other than “it works for me in most cases”.
The haskell-indentation
package and haskell-indent
packages are the most popular:
- both have a tab cycle
- both are complicated code-bases
- both have plenty of edge cases where they break down
Each will Do The Right Thing in different cases, but again, there are no unit tests, no real parser, etc. just a bunch of special cases that the author(s) happened to think of, so the documentation and understanding on how they behave in a rigorous sense is sparse. haskell-indentation
understands more Haskell than haskell-indent
, but plenty of people will tell you, including me, that you spend a lot of time cycling through indentations to get to the right one.
The haskell-simple-indent
package has no knowledge of Haskell, it only knows about column alignment and it does not have a tab cycle, it has indentation and de-indentation. This is the version I use because of the aforementioned edge cases in the previous modes, which can be rather distracting at times.
I think with such libraries it will be difficult to describe their differences other than anecdotically at this point. I would welcome some rigorous comparison (though time may well be better spent writing a better mode).
simple-indent
is maintained by me. I don't know whether the authors of the others are actively interested in maintenance.

- 5,886
- 4
- 35
- 38
I believe that the 3 modes you mention correspond to the 3 haskell-modes descibed in this article, namely;
haskell-indentation
== Tab Cyclinghaskell-indent
== Rectangular Regionhaskell-simple-indent
== Aligning Code
However since I'm not 100% sure, I'll look into more when I get home.

- 3,096
- 5
- 26
- 43
haskell-indentation
and haskell-indent
are misleadingly similar, both offer cycling through proposals via repeated typing of TAB which is their main feature IMO.
However haskell-indent
is definitely my favorite, mainly because it will propose certain completions that are quite useful:
- repeating a function name for you after you've written the type signature
- repeating a function name for pattern match
- pipes for case branches
I just recently switched environments and had to re-setup emacs, and used haskell-indentation
by mistake, and boy did I miss these. OTOH, you might find some of these completions annoying; what's more they don't work in certain cases: if your function starts with an underscore, or (worse) if you're bird-tracking.

- 791
- 6
- 5