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.
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:
It will get formated as follows:
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.