Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file optimize.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147open!Core_kernelopen!ImportopenComponentopenComposition_infix(* Notes:
- map_input being merged into a leaf node is _not_ implemented because map_input
frequently decreases the amount of incremental recomputation, e.g., by making the new
input a small part of the old one.
- project_model being merged into a leaf node is _not_ implemented for the same reasons
as above. *)letmap_over_constant=function|Packed.T{unpacked=Mapn.Map1{t=Const.Cx;f};action_type_id;model}->Packed.T{unpacked=Const.C(fx);action_type_id;model}|other->other;;letmap_over_map=function|Packed.T{unpacked=Mapn.Map1{t=Mapn.Map1{t;f=f2};f=f1};action_type_id;model}->Packed.T{unpacked=Mapn.Map1{t;f=f2>>f1};action_type_id;model}|other->other;;letmap_over_map2=function|Packed.T{unpacked=Mapn.Map1{f=f1;t=Mapn.Map2{t1;action_type_id1;t2;action_type_id2;f=f2;model1;model2}};action_type_id;model}->Packed.T{unpacked=Mapn.Map2{t1;t2;action_type_id1;action_type_id2;f=(funxy->f1(f2xy));model1;model2};action_type_id;model}|other->other;;letmap_over_leaf=function|Packed.T{unpacked=Mapn.Map1{t=Leaf.C{apply_action;compute;name};f};action_type_id;model}->letcompute~injectinputmodel=compute~injectinputmodel|>finPacked.T{unpacked=Leaf.C{apply_action;compute;name};action_type_id;model}|other->other;;letmap_input_over_map_input=function|Packed.T{unpacked=Map_input.C{t=Map_input.C{t;f=f1};f=f2};action_type_id;model}->Packed.T{unpacked=Map_input.C{t;f=f2>>f1};action_type_id;model}|other->other;;letcompose_over_pure=function|Packed.T{unpacked=Compose.C{t1=Const.Cc;t2=Pure.Pure_inputf;_};_}->Packed.T{unpacked=Const.C(fc);action_type_id=nothing_type_id;model=Packed.unit_model_info}|Packed.T{unpacked=Compose.C{t1=Pure.Pure_inputg;t2=Pure.Pure_inputf;_};_}->Packed.T{unpacked=Pure.Pure_input(g>>f);action_type_id=nothing_type_id;model=Packed.unit_model_info}|Packed.T{unpacked=Compose.C{t1=Pure.Pure_inputf;t2=t;action_type_id2;model2;_};_}->Packed.T{unpacked=Map_input.C{t;f};action_type_id=action_type_id2;model=model2}|Packed.T{unpacked=Compose.C{t1=t;t2=Pure.Pure_inputf;action_type_id1;model1;_};_}->Packed.T{unpacked=Mapn.Map1{t;f};action_type_id=action_type_id1;model=model1}|other->other;;letcompose_into_return_input(typeinputresult):(input,result,'incr,'event)Packed.t->(input,result,'incr,'event)Packed.t=function|Packed.T{unpacked=Compose.C{t1;t2=Pure.Return_input;action_type_id1;model1;_};_}->Packed.T{unpacked=t1;action_type_id=action_type_id1;model=model1}|other->other;;letwriter_over_reader(typeinputresult):(input,result,'incr,'event)Packed.t->(input,result,'incr,'event)Packed.t=function|Packed.T{unpacked=Proc.Abstraction{type_id=w;t=Proc.Var{type_id=r}};_}ast->(matchType_equal.Id.same_witnesswrwith|SomeT->Pure.input|None->t)|other->other;;letoptimizecomponent=letvisitnode=node|>writer_over_reader|>compose_into_return_input|>compose_over_pure|>map_over_constant|>map_over_map|>map_over_map2|>map_over_leaf|>map_input_over_map_inputinvisit_extcomponent({visit}:Visitor.t);;