25

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]

11
  • 3
    The layout rules (which are all that care about indentation) only come into effect when one of let/do/where/of appears; and even within a layout context, as long as you don't decrease your indent so that arg1 is indented by less than the maybe is, you run no risk of confusing the indentation. Commented Aug 14, 2015 at 19:16
  • 1
    I have the same issues. Usually I temporarily switch to simple indent mode using turn-on-haskell-simple-indent and then do the right level indent. Commented Aug 14, 2015 at 19:57
  • 2
    @amalloy Not true; foo = do maybe arg1\n.........arg2 would be interpreted very differently from foo = do maybe arg1\n...............arg2, even though in neither case does the indentation decrease. (The former would be foo = do { maybe arg1; arg2 } while the latter would correctly be foo = do { maybe arg1 arg2 }. Commented Aug 14, 2015 at 23:44
  • 1
    AFAICT, haskell-indent (as opposed to haskell-indentation) gets this one right. Commented Aug 7, 2016 at 14:49
  • 2
    I'm voting to close this question as off-topic because it belongs on the emacs.stackexchange.com site. Commented Aug 29, 2016 at 4:15

1 Answer 1

1

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

For desired behavior, use haskell-indent.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.