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

Line breaking in arguments #486

Open
samuelpilz opened this issue Feb 19, 2018 · 1 comment
Open

Line breaking in arguments #486

samuelpilz opened this issue Feb 19, 2018 · 1 comment

Comments

@samuelpilz
Copy link

It intrigues me how indenting of arguments work in hindent. The following snippets are already formatted with hindent 5.2.3 and I have no way to hint it to other formatting (no matter what I do, it gets formatted that)

function :: Arg -> Arg -> Arg -> Arg -> Arg -> Result
function reallyLongArgument1 reallyLongArgument2 reallyLongArgument3 lastReallyLongArgumentAtTheEnd whyIsThisNotBreaking =
  undefined

Note that all arguments are in one line and are not broken even if the line is over 120 chars long

It even gets worse with Records in arguments: They seem to break, however this is not convenient (for me)
All 3 cases are quite weirdly indented. Is this intentional?

For me, the current workaround is to use RecordWildCards because then, the arguments are not as long.

functionName :: SomeArg -> OtherArgWithRecord -> LastArg -> Result
functionName someArgument (recordAlias@ReallyLongRecordConstructor { recordField1
                                                                   , recordField2
                                                                   }) lastArgumentWithReallyLongName =
  undefined

Note that the record is broken on the record fields but then, the last argument follows the bracket.

function2 :: ArgWithRecord -> ArgWithRecord -> Result
function2 RecordConstructor { rellyLongAliasForField1 = field1
                            , reallyLongAliasForField2 = field2
                            } RecordConstructor { field1' = field1
                                                , field2' = field2
                                                } = undefined

Note that the next record constructor is further indented than the first and the implementation (here: undefined is after the = with no possibility for a break, since it fits the line-length

function3 :: ArgWithRecord -> ArgWithRecord -> ArgWithRecord -> Result
function3 RecordConstructor { reallyLongAliasForField1 = field1
                            , reallyLongAliasForField2 = field2
                            } RecordConstructor { field1' = field1
                                                , field2' = field2
                                                } RecordConstructor { field1
                                                                    , field2
                                                                    } =
  undefined

Here, it is clear that record-constructors are indented further and further.

I would like some line-breaking of the arguments. Is there some standard on this?

@samuelpilz
Copy link
Author

For me, hindent versions 5.2.4.1 and 5.2.5 produce exactly those results as well

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

2 participants