-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
funs are formatted incorrectly #1044
Comments
Hi! Am I right that you're trying to do the following foo() ->
fun(A, B) ->
lists:seq(1, 2)
end,
ok. |
@ignatov as usually a standalone fun expression makes no sense, you usually have them in an assignment or a function call. So the foo() ->
X = fun(A, B) ->
lists:seq(1, 2)
end.
% or
bar() ->
quux(fun(X) ->
hello
end). And this would do wrong indents. Acceptable indentation would be either: a) single indent from the expression start, and then closing |
As kvakvs said above funs are usually used in assignments, as parameters of function calls and very rarely standalone (only when you mean to return the fun as the result), so I think funs should be treated (and they are!) just like any other block construction such as case, if and begin - their content should be aligned relative to their opening word. Funs are not a special case, they are really the same as if, case etc |
this is how they are formatted now:
This is how I think is the correct way to format a fun:
btw, the rest of operators are formatted correctly :
The text was updated successfully, but these errors were encountered: