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

Indenting data types seems broken and not configurable #1125

Closed
karljs opened this issue Feb 1, 2016 · 6 comments
Closed

Indenting data types seems broken and not configurable #1125

karljs opened this issue Feb 1, 2016 · 6 comments

Comments

@karljs
Copy link
Contributor

karljs commented Feb 1, 2016

I realize there is a lot going on with indentation right now, but this seemed like a pretty extreme case of something simple not working at all. I looked through the other issues, too, and didn't spot anything. Here's the scenario. Start defining a new data type:

data Foo = Bar

Newline, pipe character, indent, now gives:

data Foo = Bar
  | Baz

And repeated tab presses do nothing to indent this further. I want to align the pipe character with the equals character, as is common when not using GADTs.

If I already have two or more lines in the data type definition, then adding more after that seems to work just fine. Thinking maybe this was just a new default, I looked through the customization options, but didn't see one that corresponds to this.

@gracjan
Copy link
Contributor

gracjan commented Feb 2, 2016

Thanks for the report. Can you add a test case in tests/haskell-indentation-tests.el?

@karljs
Copy link
Contributor Author

karljs commented Feb 3, 2016

Should be no problem. I'll take a look when I have some more spare minutes.

@gracjan
Copy link
Contributor

gracjan commented Feb 3, 2016

Great!

@gracjan
Copy link
Contributor

gracjan commented Mar 25, 2016

@karljs: How do you indent this fragment:

data User = User
  { userName :: String }
          | Admin
  { adminName :: String }

?

@karljs
Copy link
Contributor Author

karljs commented Mar 27, 2016

I wouldn't claim to have the definitive answer to this, but I would probably do the following.

data User = User { userName :: String
                 , ...}
          | Admin { adminName :: String
                  , ...}

This also seems to work fine for me currently.

@gracjan
Copy link
Contributor

gracjan commented Mar 27, 2016

Thanks. We try to reconcile two styles of indentation to reduce a bit of complexity. Hence the question.

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

No branches or pull requests

2 participants