[Haskell-cafe] question about indentation conventions
allbery.b at gmail.com
Mon Jul 1 16:10:38 CEST 2013
On Mon, Jul 1, 2013 at 9:56 AM, Tikhon Jelvis <tikhon at jelv.is> wrote:
> I've thought about writing an automatic indenting tool for Haskell (or,
> more accurately, a pretty-printer) for another project I have, and this is
> the main thing that threw me off. While automatic indentation might make
> sense for less expressive languages (Google Go being an extreme example), I
> think it would be too constraining for Haskell. After all, in reasonable
> code, chances are that similar constructs end up meaning wildly different
> things (especially with the advent of pervasive embedded DSLs), so the code
> itself is a poor indicator of its own structure.
One might look at the history of the indentation modules for Emacs
haskell-mode. Short version: they gave up, tab iterates through the
possibilities because it's quite impossible to know which one is correct
without a *semantic*, not just syntactic, understanding of the code.
(Which, when you think about it, is pretty much par for the Haskell
language definition. See also the literally impossible brace insertion rule
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe