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

newtype vs type formatting #1154

Open
Flinner opened this issue Jan 13, 2025 · 1 comment
Open

newtype vs type formatting #1154

Flinner opened this issue Jan 13, 2025 · 1 comment
Labels
style Nitpicking and things related to purely visual aspect for formatting.

Comments

@Flinner
Copy link

Flinner commented Jan 13, 2025

Is your feature request related to a problem? Please describe.
I am relatively new to Haskell, so I apologize in case I am the problem :)

Describe the solution you'd like
When formatting this:

newtype Html =
  Html String

type Title =
  String

it gets formatted as:

newtype Html
  = Html String

type Title =
  String

the equal sign placement bothers me, it isn't consistent between newtype and type, maybe this is intended behavior, I am not really sure

@amesgen amesgen added the style Nitpicking and things related to purely visual aspect for formatting. label Jan 13, 2025
@amesgen
Copy link
Member

amesgen commented Jan 13, 2025

Thanks for opening the issue! I think the historical reason for this is that newtype (as opposed to type) shares the formatting logic with data, and data with multiple constructors is often formatted with the = in the next line as it aligns with the |:

data Foo
  = Bar
  | Baz
  | Bam

However, that isn't a strong reason, and the inconsistency with type is indeed a bit weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
style Nitpicking and things related to purely visual aspect for formatting.
Projects
None yet
Development

No branches or pull requests

2 participants