Skip to content

Commit

Permalink
chore: use Fun.id instead literal lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Aug 3, 2024
1 parent 5ac33ad commit feba7fb
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/ir_def/rename.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let arg_bind rho a =
({a with it = i'}, Renaming.add a.it i' rho)

let rec prim rho p =
Ir.map_prim (fun t -> t) (id rho) p (* rename BreakPrim id etc *)
Ir.map_prim Fun.id (id rho) p (* rename BreakPrim id etc *)

and exp rho e = {e with it = exp' rho e.it}
and exp' rho = function
Expand Down
4 changes: 2 additions & 2 deletions src/languageServer/declaration_index.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ let lookup_module (project_root : string) (path : string) (index : t) :
let mic_id = Flags.M.find_opt alias index.ic_aliases in
let _ =
Debug.log "lookup_module.ic_alias.ic_id"
(string_of_option (fun x -> x) mic_id)
(string_of_option Fun.id mic_id)
in
let* id = mic_id in
let lookup_path = ic_id_to_lookup index.actor_idl_path project_root id in
Expand Down Expand Up @@ -366,7 +366,7 @@ let make_index_inner project_root vfs entry_points : t Diag.result =
index_from_scope project_root (empty project_root) libs scope
in
let actor_paths = scan_actors () in
let _ = Debug.log "Actor paths" (string_of_list (fun x -> x) actor_paths) in
let _ = Debug.log "Actor paths" (string_of_list Fun.id actor_paths) in
let actor_env =
List.fold_left
(fun acc f ->
Expand Down
14 changes: 7 additions & 7 deletions src/lowering/desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ and build_actor at ts self_id es obj_typ =
note = f.T.typ }
) fields vs)
ty)) in
let footprint_d, footprint_f = export_footprint self_id (with_stable_vars (fun e -> e)) in
let footprint_d, footprint_f = export_footprint self_id (with_stable_vars Fun.id) in
let runtime_info_d, runtime_info_f = export_runtime_information self_id in
I.(ActorE (footprint_d @ runtime_info_d @ ds', footprint_f @ runtime_info_f @ fs,
{ meta;
Expand Down Expand Up @@ -845,7 +845,7 @@ and dec' at n = function
} in
I.LetD (varPat, fn)

and cases cs = List.map (case (fun x -> x)) cs
and cases cs = List.map (case Fun.id) cs

and case f c = phrase (case' f) c

Expand Down Expand Up @@ -932,11 +932,11 @@ and to_args typ po p : Ir.arg list * (Ir.exp -> Ir.exp) * T.control * T.typ list
| S.AnnotP _ | S.ParP _ -> assert false
| S.VarP i when not must_wrap ->
{ i with note = p.note },
(fun e -> e)
Fun.id
| S.WildP ->
let v = fresh_var "param" p.note in
arg_of_var v,
(fun e -> e)
Fun.id
| _ ->
let v = fresh_var "param" p.note in
arg_of_var v,
Expand All @@ -949,18 +949,18 @@ and to_args typ po p : Ir.arg list * (Ir.exp -> Ir.exp) * T.control * T.typ list
| _, S.WildP ->
let vs = fresh_vars "ignored" tys in
List.map arg_of_var vs,
(fun e -> e)
Fun.id
| 1, _ ->
let a, wrap = to_arg p in
[a], wrap
| 0, S.TupP [] ->
[] , (fun e -> e)
[], Fun.id
| _, S.TupP ps ->
assert (List.length ps = n_args);
List.fold_right (fun p (args, wrap) ->
let (a, wrap1) = to_arg p in
(a::args, fun e -> wrap1 (wrap e))
) ps ([], fun e -> e)
) ps ([], Fun.id)
| _, _ ->
let vs = fresh_vars "param" tys in
List.map arg_of_var vs,
Expand Down
2 changes: 1 addition & 1 deletion src/mo_frontend/typing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ let check_ids env kind member ids = Lib.List.iter_pairs

let infer_mut mut : T.typ -> T.typ =
match mut.it with
| Const -> fun t -> t
| Const -> Fun.id
| Var -> fun t -> T.Mut t


Expand Down
2 changes: 1 addition & 1 deletion src/mo_interpreter/interpret.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ let import_lib env lib =
let { body = cub; _ } = lib.it in
match cub.it with
| Syntax.ModuleU _ ->
fun v -> v
Fun.id
| Syntax.ActorClassU (_sp, id, _tbs, _p, _typ, _self_id, _dec_fields) ->
fun v -> V.Obj (V.Env.from_list
[ (id.it, v);
Expand Down
8 changes: 4 additions & 4 deletions src/viper/prep.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ let mono_calls_visitor (stk : mono_goal Stack.t) : visitor =
{it = CallE({it = VarE (s @~ v_at); at=v_at; note=v_note},
{it = None; at=inst.at; note = []}, e); at; note}
| e -> e);
visit_typ = (fun t -> t);
visit_pat = (fun p -> p);
visit_dec = (fun d -> d);
visit_inst = (fun i -> i);
visit_typ = Fun.id;
visit_pat = Fun.id;
visit_dec = Fun.id;
visit_inst = Fun.id;
}

let mono_calls_dec_field (df : dec_field) : (mono_goal list * dec_field) =
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-exts/customModuleEncode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ let encode (em : extended_module) =
patch s (p + 1) (lsb (n lsr 8));
patch s (p + 2) (lsb (n lsr 16));
patch s (p + 3) (lsb (n lsr 24))
let dw_patches = ref (fun i -> i)
let dw_patches = ref Fun.id

let debug_abbrev_section () =
let tag (t, ch, kvs) =
Expand Down

0 comments on commit feba7fb

Please sign in to comment.