Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell indentation doesn't line up function arguments

Tags:

I'm using Emacs as my main Haskell editor, and as such, I of course use haskell-mode as the main mode for editing Haskell code.

Now for whatever reason, haskell-indentation doesn't offer an indent point for function arguments.

What I mean is that Emacs will consistently do this: ( is the other indent point(s))

myFunction = maybe arg1 □            arg2 □            arg3 

Instead of doing this:

myFunction = maybe arg1 □            □     arg2 □            □     arg3 

Sometimes I need to break functions up onto multiple lines due to the lines getting too long, but not having haskell-mode offer the right indent level is bugging me some.

Anything I can do to alleviate this?

Edit

Seeing as I'm not the only one with this issue, I've opened a ticket on the haskell-mode github page [here]

like image 558
Electric Coffee Avatar asked Aug 14 '15 18:08

Electric Coffee


People also ask

Does indentation matter Haskell?

Even though the consensus among Haskell programmers is that meaningful indentation leads to better-looking code, understanding how to convert from one style to the other can help understand the indentation rules.

Is Haskell indentation sensitive?

No, Haskell indentation is not like Python. Haskell is not about indentation levels, it's all about making things line up with other things.


1 Answers

The haskell-indentation haskell-mode issue was closed last year and won't be fixed.

For desired behavior, use haskell-indent.

like image 111
J_H Avatar answered Sep 22 '22 15:09

J_H