Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file leaf.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697open!Core_kernelopen!ImportopenIncremental.Let_syntaxopenComponentmoduleT=structtype('input,'model,'action,'result,'incr,'event)unpacked+=|C:{apply_action:inject:('action->'event)->schedule_event:('event->unit)->'input->'model->'action->'model;compute:inject:('action->'event)->'input->'model->'result;name:string}->('input,'model,'action,'result,'incr,'event)unpackedletsexp_of_unpackedt=matchtwith|C{apply_action=_;compute=_;name}->[%sexpLeaf(name:string)]|_->assertfalse;;letextension_constructor=[%extension_constructorC]leteval(typeimarincrevent):(i,m,a,r,incr,event)eval_type=fun~input~old_model:_~model~inject~action_type_id:_~environment:_~incr_state:_t->matchtwith|C{apply_action;compute;name=_}->let%mapinput=inputandmodel=modelinletresult=computeinputmodel~injectinletapply_action=apply_actioninputmodel~injectinSnapshot.create~result~apply_action|_->assertfalse;;letvisitcomponent(visitor:Visitor.t)=visitor.visitcomponentendincludeTletleaf(typema)(moduleM:Modelwithtypet=m)(moduleA:Actionwithtypet=a)~name~default_model~apply_action~compute=letaction_type_id=Type_equal.Id.create~nameA.sexp_of_tinletmodel_type_id=Type_equal.Id.create~nameM.sexp_of_tinPacked.T{unpacked=C{apply_action;compute;name};action_type_id;model={default=default_model;type_id=model_type_id;equal=M.equal;sexp_of=M.sexp_of_t;of_sexp=M.t_of_sexp}};;letstate_machine(typema)(moduleM:Modelwithtypet=m)(moduleA:Actionwithtypet=a)here~default_model~apply_action=letname=sprintf"state-machine defined at %s"(Source_code_position.to_stringhere)inleaf(moduleM)(moduleA)~name~default_model~apply_action~compute:(fun~inject_inputmodel->model,inject);;let()=Component.define(moduleT)