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

Leading arrows #95

Closed

Conversation

expipiplus1
Copy link
Contributor

@expipiplus1 expipiplus1 commented Jun 12, 2021

This adds a --leading-arrows option and closes #86

It's currently on top of my alignment branch for my convenience, I don't
think it should be that hard to extract though

I've extracted it from on top of my align work, although it's a more convenient for me to have it on there. I'll be keeping that up to date on this branch (joe-align-leading) https://github.com/expipiplus1/fourmolu/tree/joe-align-leading

CC @dpwiz

@expipiplus1
Copy link
Contributor Author

expipiplus1 commented Jun 12, 2021

TODO

data/examples/declaration/class/default-signatures-four-out.hs

-    bar ::
-        String ->
-        String ->
-        a
+    bar
+        :: String
+        -> String
+        -> a

Putting :: on the next line from bar looks weird (same for a few other tests including data/examples/declaration/data/field-layout/gadt-four-out.hs). This is much less of an issue with an indentation of 2 however.

GADTs sometimes look weird.

Should data/examples/declaration/value/function/typed-expressions-four-out.hs have an indented ::

in:

foo x = x::Int
bar x = Just x ::
  Maybe String

out:

foo x = x :: Int
bar x =
    Just x
    :: Maybe String

@expipiplus1
Copy link
Contributor Author

OK, I've fixed the GADT weirdness, for some reason in Ormolu the existing rendering for GADTs duplicated lots of work from p_hsType

@expipiplus1
Copy link
Contributor Author

Upstream PR for some changes: https://github.com/tweag/ormolu/pull/711/files

@dpwiz
Copy link

dpwiz commented Jun 13, 2021

You're awesome and your dog is awesome!

@expipiplus1
Copy link
Contributor Author

image

@expipiplus1
Copy link
Contributor Author

If I were to fix the merge conflicts would it stand a chance of getting merged? I think it's quite a sought after feature.

@dpwiz
Copy link

dpwiz commented Oct 28, 2021

It would be merged right away into our fourmolu fork (fourfourmolu? sixteenmolu?).

@georgefst georgefst mentioned this pull request Oct 30, 2021
@brandonchinn178 brandonchinn178 added the new config option Adds or would add new configuration option label Jan 24, 2022
@arybczak
Copy link

arybczak commented Apr 6, 2022

Hey. What is the status of this PR? It would be great to have this in fourmolu as "hanging arrows" is not the style I've seen anyone use when writing code without a formatter.

@expipiplus1
Copy link
Contributor Author

Hey. What is the status of this PR? It would be great to have this in fourmolu as "hanging arrows" is not the style I've seen anyone use when writing code without a formatter.

Probably depends on #49

@brandonchinn178
Copy link
Collaborator

👋 @expipiplus1
Thank you for opening this PR and being patient while we sorted out how to handle all the new contributions for new configuration options!

If you haven't noticed, we finally merged in a new testing framework for configuration options (#169)! This means we can finally address the backlog of open PRs.

Please do the following steps

  • Rebase against main

    git remote add upstream git@github.com:fourmolu/fourmolu
    git fetch upstream
    git rebase -i upstream/main
  • Resolve merge conflicts

  • Ensure CHANGELOG.md has been updated

  • Ensure configuration docs in README.md have been updated

  • Ensure fourmolu.yaml updated to stay in sync with config in README.md

  • Ensure tests have been added

You can use #135 as a reference for this checklist.

@expipiplus1
Copy link
Contributor Author

expipiplus1 commented Jun 1, 2022 via email

@3kyro
Copy link
Contributor

3kyro commented Jun 20, 2022

@expipiplus1 I can try rebasing your branch and adding tests if you don't mind.

@expipiplus1
Copy link
Contributor Author

expipiplus1 commented Jun 20, 2022 via email

@3kyro 3kyro mentioned this pull request Jun 22, 2022
4 tasks
@brandonchinn178
Copy link
Collaborator

Closing in favor of #209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new config option Adds or would add new configuration option
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leading arrows in types
6 participants