package tiny_libs
Source file Cmd.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26(* claude: see Cmd.mli *) type http_error = | Bad_url of string | Timeout | Network_error of string | Bad_status of int | Bad_body of string type http_response = { url : string; status : int; headers : (string * string) list; body : string } type 'msg t = | None | Msg of 'msg | Http_get of Cap.network * string * ((http_response, http_error) result -> 'msg) | Http_post of Cap.network * string * (string * string) * ((http_response, http_error) result -> 'msg) | Batch of 'msg t list let none = None let batch cmds = Batch cmds let rec to_list (cmd : 'msg t) : 'msg t list = match cmd with | None -> [] | Batch cmds -> List.concat_map to_list cmds | Msg _ | Http_get _ | Http_post _ -> [ cmd ]