From fdc63e730f91a4605ed4ff96a908e1f5e822d1bb Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Mon, 20 Apr 2026 21:55:07 -0300 Subject: New Server & Manipulation refactor Co-authored-by: Estevan Castilho --- lib/envelope.ml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/envelope.ml') diff --git a/lib/envelope.ml b/lib/envelope.ml index bed8bc0..4b8bc46 100644 --- a/lib/envelope.ml +++ b/lib/envelope.ml @@ -6,12 +6,12 @@ type tagged = { tag : string; payload : Sexplib.Sexp.t } -let parse (input : string) : (tagged, string) Result.t = - match Sexplib.Sexp.of_string input with +let parse (input : Sexplib.Sexp.t) : (tagged, Error.t) Result.t = + match input with | Sexplib.Sexp.List (Sexplib.Sexp.Atom tag :: rest) -> - let payload = - match rest with [ single ] -> single | many -> Sexplib.Sexp.List many - in - Ok { tag; payload } - | _ -> Error "expected (tag payload...)" - | exception exn -> Error (Printexc.to_string exn) + let payload = match rest with + | [single] -> single + | many -> Sexplib.Sexp.List many + in + Ok { tag; payload } + | s -> Error (Error.MalformedExpression s) -- cgit v1.2.3