-
Notifications
You must be signed in to change notification settings - Fork 203
make map ~a:(fun
and map (fun
consistent
#2706
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
base: main
Are you sure you want to change the base?
make map ~a:(fun
and map (fun
consistent
#2706
Conversation
(definition : Definition.t) | ||
: | ||
Flambda.specialised_to | ||
-> ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not great but it is consistent. I would like to box the arguments, so that
fun
arg1 arg2
: return_type
->
body
is allowed.
This seems related to #2397 |
a83a761
to
62f5320
Compare
62f5320
to
56358ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this create too much changes to be included in the next release, which is already quite impactful.
Here are some of the changes:
--- a/compiler/lib/inline.ml
+++ b/compiler/lib/inline.ml
@@ -617,8 +617,14 @@ let inline_in_block ~context pc block p =
let inline ~profile ~inline_count p ~live_vars =
if debug () then Format.eprintf "====== inlining ======@.";
(visit_closures p ~live_vars
- (fun ~recursive ~enclosing_function ~current_function ~params
- ~cont:((pc, _) as cont) (context : context) ->
+ (fun
+ ~recursive
+ ~enclosing_function
+ ~current_function
+ ~params
+ ~cont:((pc, _) as cont)
+ (context : context)
+ ->
let p = context.p in
let has_closures = ref (lazy (closure_count_uncached ~context pc > 0)) in
let in_loop = lazy (blocks_in_loop p pc) in
--- a/src/dune_lang/dune_project.ml
+++ b/src/dune_lang/dune_project.ml
@@ -506,7 +506,8 @@ let infer ~dir info packages =
let anonymous ~dir info packages = infer ~dir info packages
let encode : t -> Dune_sexp.t list =
- fun {
+ fun
+ {
name;
allow_approximate_merlin = _;
pins;
--- a/src/dune_rules/artifacts.ml
+++ b/src/dune_rules/artifacts.ml
@@ -110,7 +110,8 @@ let create =
Option.value ~default:name (String.drop_suffix name ~suffix:".exe")
else name
in
- fun (context : Context.t)
+ fun
+ (context : Context.t)
~(local_bins : origin Appendable_list.t Filename.Map.t Memo.Lazy.t)
->
let local_bins =
object | ||
method class_infos : 'a. ('a -> 'res) -> 'a class_infos -> 'res = | ||
fun _a | ||
fun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to fun
expressions that are not arguments, and I'm not sure if that makes sense.
Perhaps you could restrict the change to fun
expressions that are in parentheses ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its okay to merge without that. I am guessing that if I did not merge that I was not that happy with the result.
As for this, I do think the wrong part is changed. The arrow is what should be moved to mark a separation between the function argument and the body.
There used to be two formatting for these two syntaxes.
This makes them consistent. I picked the syntax of
~a:(fun
because it was the nicest one in my opinion.(fun
without label has slightly less indentation.I would like fun exprs to always be formatted like
because
is just not readable: its quite hard to see were the arg ends and where the body starts.
As a comparison, we never ever do
I realize this is probably to large of a diff overall, but achieving it would also be both nice and make the code a lot simpler.