Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskell-indent-align-def, via haskell-indent-start-of-def, causes type of definition to align with '=' #235

Closed
philipdexter opened this issue Feb 5, 2014 · 5 comments

Comments

@philipdexter
Copy link

Calling an align on

test :: Int -> Int -> Int
test x y = x
test x y     = y

gives

test     :: Int -> Int -> Int
test x y = x
test x y = y

I have looked briefly and I haven't found any Haskell code that uses this indentation style. I believe it should give

test :: Int -> Int -> Int
test x y = x
test x y = y

I have created a patch that changes

  • haskell-indent-start-of-def to discard type lines (note: start-of-def is only called when P-ARG is nil)
  • haskell-indent-align-guards-and-rhs to take a universal argument that switches on the P-ARG argument to haskell-indent-align-def

Result:

  • to include type definitions in alignment prefix C-u

Thoughts?

There are other places in the alignment code that this could be changed. However I wanted to keep this fix simple and I didn't want to forbid aligning of code like

test :: Int
testSecond :: Int

to

test       :: Int
testSecond :: Int
@philipdexter
Copy link
Author

Actually, for this to work properly, all of the insert methods will have to handle the C-u. Including insert-equal, insert-guard, and maybe more?

This might be too messy.

@philipdexter
Copy link
Author

This seems to have been fixed in the case of haskell-indent-align-guards-and-rhs (sorry, hadn't fetched in a little while), but not in cases such as insert-equal and insert-guard

@ivan-m
Copy link
Contributor

ivan-m commented Feb 6, 2014

That style of alignment was rather popular at one stage I believe; I started using it early on when I started writing Haskell and only recently have stopped doing so.

@gracjan
Copy link
Contributor

gracjan commented Apr 14, 2015

This issue has not seen activity for a very long time. Is this still something we should be concerned about?

@philipdexter
Copy link
Author

It doesn't seem like it's a universal issue, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants