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

[RFC] Single rule for where #45

Open
vrom911 opened this issue Dec 16, 2020 · 2 comments
Open

[RFC] Single rule for where #45

vrom911 opened this issue Dec 16, 2020 · 2 comments
Labels

Comments

@vrom911
Copy link
Member

vrom911 commented Dec 16, 2020

For now, we have a policy for where in the functions, and different rules for other places where where is used (e.g. type classes, instances, etc.).
I propose to apply the existing where rule to all wheres:

class Semigroup a 
  where
    (<>) :: a -> a -> a

We would have:
a. A single rule – easier to remember
b. Consistent style of where usage
c. Solved problem of huge constraints in the type classes definitions
d. Discourage for writing empty wheres in instances
e. ?

I guess it would have a positive effect. Let me know what you think! 👂🏼

@vrom911 vrom911 added the style label Dec 16, 2020
@chshersh
Copy link
Contributor

@vrom911 I agree here with your reasoning 👍🏻 Even though, I'm not used to writing code like this, I feel that this consistency is very beneficial. Moreover, I imagine we can even utilize Hintman here to check that spaces on each line are multiples of 4, and are multiples of 2 for lines with where to have some code style checks automatic.

The problem with huge constraints in classes and instances (and sometimes even with pragmas like {-# OVERLAPPABLE #-}) is a problem indeed. And I'm all for solving this problem consistently once and for all.

@chshersh
Copy link
Contributor

chshersh commented Apr 8, 2021

I want to mention that using this formatting rule is a nice experience, and I like it so far 🙂

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

No branches or pull requests

2 participants