Skip to content

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.

1 participant