changing the name of the lambda to 'arguments' make its arguments available
This commit is contained in:
parent
164e88e818
commit
a3deccf352
@ -1054,7 +1054,7 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun
|
|||||||
|
|
||||||
|
|
||||||
(* build the X_FOLD constant *)
|
(* build the X_FOLD constant *)
|
||||||
let lambda = e_lambda "_COMPILER_for_collect_lambda" None None block' in
|
let lambda = e_lambda "arguments" None None block' in
|
||||||
let%bind collect = simpl_expression fc.expr in
|
let%bind collect = simpl_expression fc.expr in
|
||||||
let op_name = match fc.collection with
|
let op_name = match fc.collection with
|
||||||
| Map _ -> "MAP_FOLD"
|
| Map _ -> "MAP_FOLD"
|
||||||
|
@ -618,7 +618,7 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
|
|||||||
| E_constant ( ("LIST_FOLD"|"MAP_FOLD"|"SET_FOLD") as opname ,
|
| E_constant ( ("LIST_FOLD"|"MAP_FOLD"|"SET_FOLD") as opname ,
|
||||||
[ collect ;
|
[ collect ;
|
||||||
init_record ;
|
init_record ;
|
||||||
( { expression = (I.E_lambda { binder = (name, None) ;
|
( { expression = (I.E_lambda { binder = (lname, None) ;
|
||||||
input_type = None ;
|
input_type = None ;
|
||||||
output_type = None ;
|
output_type = None ;
|
||||||
result }) ;
|
result }) ;
|
||||||
@ -636,10 +636,10 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
|
|||||||
let input_type = t_tuple (tv_out::[collect_inner_type]) () in
|
let input_type = t_tuple (tv_out::[collect_inner_type]) () in
|
||||||
let output_type = Some tv_out in
|
let output_type = Some tv_out in
|
||||||
|
|
||||||
let e' = Environment.add_ez_binder "arguments" input_type e in
|
let e' = Environment.add_ez_binder lname input_type e in
|
||||||
let%bind body = type_expression ?tv_opt:output_type e' result in
|
let%bind body = type_expression ?tv_opt:output_type e' result in
|
||||||
let output_type = body.type_annotation in
|
let output_type = body.type_annotation in
|
||||||
let%bind lambda' = ok @@ make_a_e (E_lambda {binder = name ; body}) (t_function input_type output_type ()) e in
|
let%bind lambda' = ok @@ make_a_e (E_lambda {binder = lname ; body}) (t_function input_type output_type ()) e in
|
||||||
|
|
||||||
let%bind lst' = ok @@ lst'@[lambda'] in
|
let%bind lst' = ok @@ lst'@[lambda'] in
|
||||||
let tv_lst = List.map get_type_annotation lst' in
|
let tv_lst = List.map get_type_annotation lst' in
|
||||||
|
Loading…
Reference in New Issue
Block a user