text
stringlengths
0
601k
module Import = struct type import = { name : Reference . t ; alias : Identifier . t option ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] type t = { from : Reference . t option ; imports : import Node . t list ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] let location_insensitive_compare l...
module Raise = struct type t = { expression : Expression . t option ; from : Expression . t option ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] let location_insensitive_compare left right = match Option . compare Expression . location_insensitive_compare left . expression right . expression with | x whe...
module Return = struct type t = { is_implicit : bool ; expression : Expression . t option ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] let location_insensitive_compare left right = match Bool . compare left . is_implicit right . is_implicit with | x when not ( Int . equal x 0 ) -> x | _ -> Option . comp...
module Decorator = struct type t = { name : Reference . t Node . t ; arguments : Expression . Call . Argument . t list option ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] let location_insensitive_compare left right = match Reference . compare left . name . value right . name . value with | x when not ( ...
module rec Assert : sig module Origin : sig type t = | Assertion | If of { true_branch : bool } | While of { true_branch : bool } | Match [ @@ deriving compare , sexp , show , hash , to_yojson ] val location_insensitive_compare : t -> t -> int end type t = { test : Expression . t ; message : Expression . t option ; ori...
module PrettyPrinter = struct let pp_decorators formatter = function | [ ] -> ( ) | decorators -> Format . fprintf formatter " [ @< v ( >@@% a ) ; ] " @@ Expression . pp_expression_list decorators let pp_reference_option formatter = function | None -> ( ) | Some reference -> Format . fprintf formatter " % a " Reference...
let show statement = Format . asprintf " % a " pp statement
let show_statement statement = Format . asprintf " % a " pp_statement statement
let is_generator statements = let open Expression in let rec is_expression_generator { Node . value ; _ } = match value with | Expression . Yield _ | Expression . YieldFrom _ -> true | Await await -> is_expression_generator await | BooleanOperator { BooleanOperator . left ; right ; _ } | ComparisonOperator { Comparison...
let statements_location_insensitive_equal left right = List . compare Statement . location_insensitive_compare left right |> Int . equal 0
let statements_print_to_sexp statements = Sexp . to_string_hum ( ( List . sexp_of_t Statement . sexp_of_t ) statements )
let assert_parsed ~ context ~ expected text = match PyreNewParser . parse_module ~ context ~ enable_type_comment : true text with | Result . Error { PyreNewParser . Error . message ; _ } -> let message = Format . sprintf " Unexpected parsing failure : % s " message in assert_failure message | Result . Ok actual -> asse...
let test_pass_break_continue _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " pass " ~ expected [ :+ Statement . Pass ] ; assert_parsed " break " ~ expected [ :+ Statement . Break ] ; assert_parsed " continue " ~ expected [ :...
let test_global_nonlocal _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " global a " ~ expected [ :+ Statement . Global [ " a " ] ] ; assert_parsed " global a , b " ~ expected [ :+ Statement . Global [ " a " ; " b " ] ] ; ass...
let test_expression_return_raise _ = let do_test context = let assert_parsed = assert_parsed ~ context in assert_parsed " a " ~ expected [ :+ Statement . Expression " ! a " ] ; assert_parsed " a is b " ~ expected : [ + Statement . Expression ( + Expression . ComparisonOperator { ComparisonOperator . left = " ! a " ; op...
let test_assert_delete _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " assert a " ~ expected : [ + Statement . Assert { Assert . test = " ! a " ; message = None ; origin = Assert . Origin . Assertion } ] ; assert_parsed " as...
let test_import _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " import a " ~ expected : [ + Statement . Import { Import . from = None ; imports = [ { + Import . name = " !& a " ; alias = None } ] } ; ] ; assert_parsed " impo...
let test_for_while_if _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " for a in b : c \ n " ~ expected : [ + Statement . For { For . target = " ! a " ; iterator = " ! b " ; body = [ + Statement . Expression " ! c " ] ; orelse...
let test_try _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " try :\ n \ ta \ nfinally :\ n \ tb " ~ expected : [ + Statement . Try { Try . body = [ + Statement . Expression " ! a " ] ; handlers = [ ] ; orelse = [ ] ; finally...
let test_with _ = let do_test context = let assert_parsed = assert_parsed ~ context in assert_parsed " with a : b \ n " ~ expected : [ + Statement . With { With . items = [ " ! a " , None ] ; body = [ + Statement . Expression " ! b " ] ; async = false } ; ] ; assert_parsed " with a :\ n b \ n c " ~ expected : [ + State...
let test_define _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in assert_parsed " def foo ( a ) :\ n 1 " ~ expected : [ + Statement . Define { signature = { name = " !& foo " ; parameters = [ { + Parameter . name = " a " ; value = None ; anno...
let test_match _ = let do_test context = let assert_parsed = assert_parsed ~ context in let assert_not_parsed = assert_not_parsed ~ context in let assert_case_parsed case_source ~ expected_pattern ~ expected_guard = assert_parsed ( " match x :\ n " ^ case_source ^ " :\ n pass " ) ~ expected : [ + Statement . Match { Ma...
let ( ) = " parse_statements " >::: [ " pass_break_continue " >:: test_pass_break_continue ; " global_nonlocal " >:: test_global_nonlocal ; " expression_return_raise " >:: test_expression_return_raise ; " assert_delete " >:: test_assert_delete ; " import " >:: test_import ; " for_while_if " >:: test_for_while_if ; " tr...
module SSet = Set . Make ( String )
module type STATEMENT = sig val for_ : env -> ( Loc . t , Loc . t ) Statement . t val if_ : env -> ( Loc . t , Loc . t ) Statement . t val let_ : env -> ( Loc . t , Loc . t ) Statement . t val try_ : env -> ( Loc . t , Loc . t ) Statement . t val while_ : env -> ( Loc . t , Loc . t ) Statement . t val with_ : env -> ( ...
module Statement ( Parse : PARSER ) ( Type : Type_parser . TYPE ) ( Declaration : Declaration_parser . DECLARATION ) ( Object : Object_parser . OBJECT ) ( Pattern_cover : Pattern_cover . COVER ) : STATEMENT = struct type for_lhs = | For_expression of pattern_cover | For_declaration of ( Loc . t * ( Loc . t , Loc . t ) ...
module type Regex = sig type t val epsilon : t val ( . ) ^ : t -> t -> t val ( . ) | : t -> t -> t val star : t -> t end
module type NFA = sig module States : Strong . Natural . T module Transitions : Strong . Natural . T type label val label : Transitions . n elt -> label val source : Transitions . n elt -> States . n elt val target : Transitions . n elt -> States . n elt module Initials : Array . T with type a = States . n elt module F...
module Convert ( Regex : Regex ) ( NFA : NFA with type label := Regex . t ) : sig val result : ( NFA . Initials . n , ( NFA . Finals . n elt * Regex . t list ) list ) Array . t struct type temp = | Unused | Label of Regex . t | Final of { index : NFA . Finals . n elt ; mutable regexes : Regex . t list } type state = { ...
let convert ( type regex initials finals ) ( module Regex : Regex with type t = regex ) ( module NFA : NFA with type label = regex and type Initials . n = initials and type Finals . n = finals ) : ( initials , ( finals elt * regex list ) list ) Array . t = let module Result = Convert ( Regex ) ( NFA ) in Result . resul...
type t = { state_error_errors : Result_util . message list ; _state_error_location : string }
let state_error , set_state_error = React . S . create ( [ ] : t list )
let clear_errors location = let ( ) = Common . debug ( Js . string ( Format . sprintf " Clear_errors % s " location ) ) in set_state_error [ ]
let has_errors ( ) = match React . S . value state_error with | [ ] -> false | _ :: _ -> true
let add_error ( location : string ) ( errors : Result_util . message list ) = let ( ) = Common . debug ( Js . string ( Format . asprintf " set_errors { location : " \% s " \ , errors : [ [ @% a ] ] @ } " location ( Pp . list Pp . space Result_util . print_message ) errors ) ) in let current_state_error : t list = React...
let errors : Result_util . message list React . signal = React . S . map ( fun ( state_error : t list ) -> List . fold_left ( fun acc value -> value . state_error_errors @ acc ) [ ] state_error ) state_error
let wrap : ' a . ? append : bool -> string -> ' a Api . result Lwt . t -> ' a Api . result Lwt . t = fun ( ? append = false ) loc r -> r >>= ( let ( ) = if not append then clear_errors loc in Result_util . fold ~ ok ( : fun r -> Lwt . return ( Result_util . ok r ) ) ~ error ( : fun errors -> let ( ) = add_error loc err...
let section = [ " node " ; " state " ]
let missing_pruned_contents = declare_1 ~ section ~ name " : missing_pruned_contents " ~ msg " : cannot find pruned contents of block { block_hash } " ~ level : Error ( " block_hash " , Block_hash . encoding )
let pop_block = declare_1 ~ section ~ name " : pop_block " ~ msg " : pop_block { block_hash } " ~ level : Debug ( " block_hash " , Block_hash . encoding )
let push_block = declare_1 ~ section ~ name " : push_block " ~ msg " : push_block { block_hash } " ~ level : Debug ( " block_hash " , Block_hash . encoding )
let destroy_state = declare_1 ~ section ~ name " : destroy_state " ~ msg " : destroy { chain_id } " ~ level : Debug ( " chain_id " , Chain_id . encoding )
let textbox : ( string * Vdom . Node . t ) Computation . t = let % sub state , set_state = Bonsai . state [ % here ] ( module String ) ~ default_model " " : in return ( let % map state = state and set_state = set_state in let view = Vdom . Node . input ~ attr : Vdom . Attr . ( value_prop state @ on_input ( fun _ new_te...
let ( ) = Util . run ( textbox |> Computation . map ~ f : snd ) ~ id " : textbox "
let two_textboxes : Vdom . Node . t Computation . t = let % sub textbox_a = textbox in let % sub textbox_b = textbox in return ( let % map contents_a , view_a = textbox_a and contents_b , view_b = textbox_b in let display = Vdom . Node . textf " a : % s , b : % s " contents_a contents_b in Vdom . Node . div ~ attr ( : ...
let ( ) = Util . run two_textboxes ~ id " : two_textboxes "
let two_textboxes_shared_state : Vdom . Node . t Computation . t = let % sub textbox_a = textbox in let textbox_b = textbox_a in return ( let % map contents_a , view_a = textbox_a and contents_b , view_b = textbox_b in let display = Vdom . Node . textf " a : % s , b : % s " contents_a contents_b in Vdom . Node . div ~ ...
let ( ) = Util . run two_textboxes_shared_state ~ id " : two_textboxes_shared_state "
let state_based_counter : Vdom . Node . t Computation . t = let % sub state , set_state = Bonsai . state [ % here ] ( module Int ) ~ default_model : 0 in return ( let % map state = state and set_state = set_state in let decrement = Vdom . Node . button ~ attr ( : Vdom . Attr . on_click ( fun _ -> set_state ( state - 1 ...
let ( ) = Util . run state_based_counter ~ id " : state_based_counter "
module Action = struct type t = | Increment | Decrement [ @@ deriving sexp_of ] end
let counter_state_machine : Vdom . Node . t Computation . t = let % sub state , inject = Bonsai . state_machine0 [ % here ] ( module Int ) ( module Action ) ~ default_model : 0 ~ apply_action ( : fun ~ inject : _ ~ schedule_event : _ model action -> match action with | Increment -> model + 1 | Decrement -> model - 1 ) ...
let ( ) = Util . run counter_state_machine ~ id " : counter_state_machine "
type slot = { local : string option ; name : string ; }
type active = { rank : int ; cursor_pos : Locality . position ; out_of_sync : bool }
type model = { current : active option ; directory : slot Mods . IntMap . t }
let dummy_cursor_pos = { Locality . line = - 1 ; Locality . chr = 0 }
let blank_state = { current = None ; directory = Mods . IntMap . empty }
let model , set_directory_state = React . S . create blank_state
type refresh = { filename : string ; content : string ; line : int option ; }
let refresh_file , set_refresh_file = React . E . create ( )
let current_filename = React . S . map ( fun m -> Option_util . bind ( fun x -> Option_util . map ( fun { name ; _ } -> name ) ( Mods . IntMap . find_option x . rank m . directory ) ) m . current ) model
let with_current_pos ? eq ( ? on = React . S . const true ) f default = React . S . fmap ? eq ( fun m -> Option_util . bind ( fun x -> Option_util . bind ( fun { name ; _ } -> f name x . cursor_pos ) ( Mods . IntMap . find_option x . rank m . directory ) ) m . current ) default ( React . S . on on blank_state model )
let with_current_file f = let state = React . S . value model in match state . current with | None -> let error_msg : string = " Attempt to fetch file with none selected . " in Lwt . return ( Api_common . result_error_msg error_msg ) | Some active -> match Mods . IntMap . find_option active . rank state . directory wit...
let get_file ( ) : ( string * string ) Api . result Lwt . t = with_current_file ( fun _state active -> function | { local = None ; name } -> State_project . with_project ~ label " : get_file " ( fun manager -> manager # file_get name >>= Api_common . result_bind_lwt ~ ok ( : fun ( text , rank ' ) -> if active . rank = ...
let send_refresh ( line : int option ) : unit Api . result Lwt . t = match ( React . S . value model ) . current with | None -> Lwt . return ( Result_util . ok ( ) ) | Some { out_of_sync ; _ } -> if out_of_sync then Lwt . return ( Api_common . result_error_msg " File was not in sync . Switching may lead to data lost . ...
let update_directory ~ reset current catalog = let state = React . S . value model in let directory = List . fold_left ( fun acc { Kfiles . position ; id } -> Mods . IntMap . add position { name = id ; local = None } acc ) ( if reset then Mods . IntMap . empty else state . directory ) catalog in set_directory_state { c...
let create_file ( ~ filename : string ) ( ~ content : string ) : unit Api . result Lwt . t = State_project . with_project ~ label " : create_file " ( fun manager -> manager # file_catalog >>= Api_common . result_bind_lwt ~ ok ( : fun catalog -> let matching_file = List . filter ( fun file_metadata -> filename = file_me...
let rec choose_file choice = function | [ ] -> let error_msg : string = Format . sprintf " Failed to switch file % s . " choice in Api_common . result_error_msg error_msg | { Kfiles . id ; position } :: t -> if choice = id then Result_util . ok position else choose_file choice t
let select_file ( filename : string ) ( line : int option ) : unit Api . result Lwt . t = State_project . with_project ~ label " : select_file " ( fun manager -> manager # file_catalog >>= Api_common . result_bind_lwt ~ ok ( : fun catalog -> Api_common . result_bind_lwt ~ ok ( : fun rank -> let ( ) = update_directory ~...
let set_content ( content : string ) : unit Api . result Lwt . t = with_current_file ( fun state active -> function | { local = Some _ ; name } -> let directory = Mods . IntMap . add active . rank { local = Some content ; name } state . directory in let ( ) = set_directory_state { current = state . current ; directory ...
let set_compile file_id ( compile : bool ) : unit Api . result Lwt . t = let state = React . S . value model in match Mods . IntMap . filter_one ( fun _ { name ; _ } -> name = file_id ) state . directory with | None -> let error_msg = " Internal inconsistency : No file " ^ file_id in Lwt . return ( Api_common . result_...
let remove_file ( ) : unit Api . result Lwt . t = with_current_file ( fun state active { local ; name } -> let directory = Mods . IntMap . remove active . rank state . directory in let current = Option_util . map ( fun ( rank , _ ) -> { rank ; cursor_pos = dummy_cursor_pos ; out_of_sync = false } ) ( Mods . IntMap . ro...
let do_a_move state file_id rank = match Mods . IntMap . filter_one ( fun _ { name ; _ } -> name = file_id ) state . directory with | None -> let error_msg = " Internal inconsistency : No file " ^ file_id in Lwt . return ( Api_common . result_error_msg error_msg ) | Some ( rank ' , ( { local ; _ } as x ) ) -> let direc...
let rec set_position state file_id rank = match Mods . IntMap . find_option rank state . directory with | Some { name ; _ } -> if file_id = name then Lwt . return ( Result_util . ok state ) else set_position state name ( succ rank ) >>= Api_common . result_bind_lwt ~ ok ( : fun state ' -> do_a_move state ' file_id rank...
let order_files ( filenames : string list ) : unit Api . result Lwt . t = let rec _order_file filenames state index : unit Api . result Lwt . t = match filenames with | [ ] -> let ( ) = set_directory_state state in Lwt . return ( Result_util . ok ( ) ) | file_id :: tail -> ( set_position state file_id index ) >>= Api_c...
let cursor_activity ~ line ~ ch = let v = React . S . value model in match v . current with | None -> ( ) | Some { rank ; out_of_sync ; _ } -> set_directory_state { current = Some { rank ; cursor_pos { = Locality . line = succ line ; chr = ch } ; out_of_sync } ; directory = v . directory ; }
let out_of_sync out_of_sync = let v = React . S . value model in match v . current with | None -> ( ) | Some { rank ; cursor_pos ; _ } -> set_directory_state { current = Some { rank ; cursor_pos ; out_of_sync } ; directory = v . directory ; }
let sync ( ? reset = false ) ( ) : unit Api . result Lwt . t = State_project . with_project ~ label " : select_file " ( fun manager -> manager # file_catalog >>= Api_common . result_bind_lwt ~ ok ( : fun catalog -> let cand = ( React . S . value model ) . current in let pos = if reset || match cand with | None -> true ...
let load_default ( ) : unit Lwt . t = ( create_file ~ filename " : model . ka " ~ content " " ) : >>= ( Result_util . fold ~ ok ( : fun ( ) -> Lwt . return_unit ) ~ error ( : fun errors -> let msg = Format . asprintf " State_file . load_default : creating default file error @ [ @< v >% a ] " @ ( Pp . list Pp . space Re...
let load_models ( ) : unit Lwt . t = let models = Common_state . url_args " model " in let rec add_models models load_file : unit Lwt . t = match models with | [ ] -> Lwt . return_unit | model :: models -> Js_of_ocaml_lwt . XmlHttpRequest . get model >>= ( fun content -> if content . Js_of_ocaml_lwt . XmlHttpRequest . ...
let init ( ) : unit Lwt . t = Lwt . return_unit >>= load_models
module State_hashes = struct [ %% versioned module Stable = struct module V1 = struct type t = { mutable state_body_hash : State_body_hash . Stable . V1 . t option ; state_hash : T . Stable . V1 . t } [ @@ deriving equal , sexp , to_yojson ] to_yojson let to_latest = Fn . id end end ] end let state_hash { state_hash ; ...
module With_state_hashes = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type ' a t = ( ' a , State_hashes . Stable . V1 . t ) t With_hash . Stable . V1 . t [ @@ deriving equal , sexp , to_yojson ] to_yojson let to_latest = Fn . id end end ] end ...
let spawn_console ~ rpc ? name ? env ? cwd prog args = ignore name ; let cwd = Option . value ~ default ( : Filename . dirname prog ) prog cwd in let cmd = ( " " , prog :: args |> Array . of_list ) of_list in let curr_env = Unix . environment ( ) |> Array . to_seq |> Seq . map ( String . cut_on_char ' = ' ) ' |> Seq . ...
let spawn_terminal ~ kind ~ rpc ? name ? env ? cwd prog args = let cwd = match cwd with Some cwd -> cwd | None -> Filename . dirname prog in Lwt . async ( fun ( ) -> let % lwt _ = Debug_rpc . exec_command rpc ( module Run_in_terminal_command ) Run_in_terminal_command Run_in_terminal_command . Arguments . { kind = Some ...
let spawn ~ kind ~ rpc ? name ? env ? cwd prog args = let open Launch_command . Arguments in match kind with | Console . Internal_console -> spawn_console ~ rpc ? env ? cwd prog args | Integrated_terminal -> spawn_terminal ~ kind : Run_in_terminal_command . Arguments . Kind . Integrated ~ rpc ? name ? env ? cwd prog ar...
let launch ~ rpc ~ init_args ~ capabilities ~ launch_args = ignore init_args ; ignore capabilities ; let open Launch_command . Arguments in let open Initialize_command . Arguments in if launch_args . _debug_log |> Option . is_some then ( Logs . set_level ( Some Debug ) Debug ; let file = open_out ( launch_args . _debug...
let run ~ init_args ~ capabilities rpc = let promise , resolver = Lwt . task ( ) in let prevent_reenter ( ) = Debug_rpc . remove_command_handler rpc ( module Launch_command ) Launch_command ; Debug_rpc . remove_command_handler rpc ( module Attach_command ) Attach_command in Debug_rpc . set_command_handler rpc ( module ...
type t = { init_stopping_times : ( Nbr . t * int ) list ; mutable stopping_times : ( Nbr . t * int ) list ; perturbations_alive : bool array ; time_dependent_perts : int list ; mutable force_test_perturbations : int list ; perturbations_not_done_yet : bool array ; mutable flux : ( string * Data . din_data ) list ; with...
let compare_stops ( t1 , p1 ) ( t2 , p2 ) = let t = Nbr . compare t1 t2 in if t = 0 then compare p1 p2 else t
let empty ~ with_delta_activities counter env = let t0 = Counter . init_time counter in let stopping_times = let algs_deps = Model . all_dependencies env in Model . fold_perturbations ( fun i acc x -> match x . Primitives . alarm with | Some n -> let k = 1 . . + floor ( t0 . / Option_util . unsome 0 . ( Nbr . to_float ...
let observables_values env graph counter = Model . map_observables ( Rule_interpreter . value_alg counter graph ) env
let do_modification ~ debugMode ~ outputs env counter graph state extra modification = let print_expr_val = Kappa_printer . print_expr_val ( Rule_interpreter . value_alg counter graph ) in match modification with | Primitives . ITER_RULE ( ( v , _ ) , r ) -> let text = Format . asprintf " [ @< h >% a ] " @ ( Kappa_prin...
let rec perturbate ~ debugMode ~ outputs ~ is_alarm env counter graph state mix_changed = function | [ ] -> ( false , graph , state , mix_changed ) | i :: tail -> let pert = Model . get_perturbation env i in let mod_alarm = match pert . Primitives . alarm with | None -> true | Some _ -> is_alarm in if state . perturbat...
let do_modifications ~ debugMode ~ outputs env counter graph state list = let ( stop , graph , state , extra ) = List . fold_left ( fun ( stop , graph , state , extra as acc ) effect -> if stop then acc else do_modification ~ debugMode ~ outputs env counter graph state extra effect ) ( false , graph , state , [ ] ) lis...
let initialize ~ bind ~ return ~ debugMode ~ outputs env counter graph0 state0 init_l = let mgraph = List . fold_left ( fun mstate ( alg , compiled_rule ) -> bind mstate ( fun ( stop , state , state0 ) -> let value = Rule_interpreter . value_alg counter state alg in let actions = compiled_rule . Primitives . instantiat...
let one_rule ~ debugMode ~ outputs ~ maxConsecutiveClash env counter graph state instance = let prev_activity = Rule_interpreter . activity graph in let act_stack = ref [ ] in let finalize_registration my_syntax_rd_id = match state . flux , state . with_delta_activities with | [ ] , false -> ( ) | l , _ -> let ( ) = if...
let rec perturbate_until_first_backtrack ~ debugMode env counter ~ outputs ( stop , graph , state , dt ) = match state . stopping_times with | [ ] -> ( stop , graph , state , dt , false ) | ( ti , pe ) :: tail -> if ( Nbr . is_smaller ti ( Nbr . F ( Counter . current_time counter . + dt ) ) ) then let pert = Model . ge...
let perturbate_with_backtrack ~ debugMode ~ outputs env counter graph state = function | [ ] -> assert false | ( ti , pe ) :: tail -> let tail ' = match ( Model . get_perturbation env pe ) . Primitives . alarm with | None -> tail | Some n -> List_util . merge_uniq compare_stops [ ( ( Nbr . add ti n ) , pe ) ] tail in l...