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

Add 'only-args' option to 'function-arrows' #233

Closed
brandonchinn178 opened this issue Aug 19, 2022 · 2 comments · Fixed by #248
Closed

Add 'only-args' option to 'function-arrows' #233

brandonchinn178 opened this issue Aug 19, 2022 · 2 comments · Fixed by #248

Comments

@brandonchinn178
Copy link
Collaborator

Describe the option you'd like to add
#209 added support for leading arrows, but one thing people might prefer is a mixture of leading/trailing, where only the thin arrows are leading. Why?

  • :: is next to function name, for greppability
  • Can use trailing haddocks for arguments
  • Friendlier diffs when adding explicit forall or constraints

Show a code example exemplifying the different option settings

-- trailing
foo ::
  forall a.
  (C1, C2) =>
  Int ->
  String ->
  Bool

-- leading
foo
  :: forall a
  . (C1, C2)
  => Int
  -> String
  -> Bool

-- only-args
foo ::
  forall a.
  (C1, C2) =>
     Int
  -> String
  -> Bool
@tchoutri
Copy link

tchoutri commented Sep 10, 2022

I would definitely support an option to keep the :: on the same line as the function name and having aligned leading arrows. Especially for those of us who can't use HLS yet and don't necessarily have a tags program installed.

Really something like:

-- leading
foo :: forall a
    . (C1, C2)
    => Int
    -> String
    -> Bool

@brandonchinn178
Copy link
Collaborator Author

Is there a reason why you want everything aligned after the function name? The problem with that is the bad diffs when renaming the function. IMO it also doesnt look great to have signatures misaligned across a file

someLongFuncName :: Int
                 -> String
                 -> Bool

anotherFunc :: Int
            -> String
            -> Bool

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

Successfully merging a pull request may close this issue.

2 participants