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

More liberal way of aligning matches #83

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alexgerdes
Copy link

The current implementation is quite restrictive in aligning matches. For example, if one function binding has a where-clause, aligning is abandoned. The same goes for if a function binding has a guarded right hand side. This commit allows for a more liberal way of aligning matches; something that I find myself doing all the time.

Consider the following snippet:

fun [] = 0
fun [_] = n
 where
  n = 1
f un (x : y : z : zs)
  | x > n = 2
  | otherwise = 3
 where
  n = 42

It will get formated as follows:

fun []        = 0
fun [_]       = n
 where
  n = 1
fun (x : y : z : zs)
  | x > n     = 2
  | otherwise = 3
 where
  n = 42

This way of aligning is nicely controlled by the limits, e.g., setting the limit to 6 will not align the equal signs in this particular example.

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 this pull request may close these issues.

None yet

1 participant