[Haskell-cafe] question about indentation conventions

Patrick Mylund Nielsen haskell at patrickmylund.com
Mon Jul 1 03:23:39 CEST 2013


The Haskell Style Guide is quite popular:
https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
(accompying
elisp module:
https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.el)

I am not sure what the verdict is on functions spanning multiple lines,
other than 80 columns being the max line length. Personally, I do what
haskell-mode + style-guide.el default to, which is to indent to the same
level like you said, e.g.:

        fun a b c
        d e f

Looking at some of the style guide author's code seems to suggest this is
what he does too:
https://github.com/tibbe/ekg/blob/master/System/Remote/Snap.hs#L155

Of course, you're free to do it whichever way you prefer--it only matters
if you are collaborating with others who don't share your preferences
(always a fun activity.)

It would be cool if there was a The One Formatting Tool for Haskell, a la
"go fmt" for Go, or an 'indent' without so many options that the tool is
moot.


On Sun, Jun 30, 2013 at 9:04 PM, Richard Cobbe <cobbe at ccs.neu.edu> wrote:

> On Sun, Jun 30, 2013 at 05:41:46PM -0700, Darren Grant wrote:
> > Hi Richard,
> >
> > This page helped me when starting out:
> > http://en.wikibooks.org/wiki/Haskell/Indentation
> > On 2013-06-30 4:55 PM, "Richard Cobbe" <cobbe at ccs.neu.edu> wrote:
>
> <snip>
>
> > > 1) Are there wide-spread conventions in the Haskell community for how
> to
> > > indent an application expression that's split across multiple lines?
>  For
> > > how to indent an expression that uses infix operators?  Or does
> everyone
> > > pretty much do their own thing?
>
> <snip>
>
> Thanks for the pointer, Darren, and I did come across that page earlier.
>
> I should have been clearer in my original question: I'm curious about what
> to do when a multi-argument function application gets split across lines.
> That wiki page dicsusses how the layout rule interacts with various special
> forms (let, where, if, do, case), but it doesn't seem to address function
> applications, beyond implying that it's ok to indent the continuing lines
> of a function application.
>
> Richard
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130630/0a4e9617/attachment.htm>


More information about the Haskell-Cafe mailing list