diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-04-20 21:55:07 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-20 21:55:07 -0300 |
| commit | fdc63e730f91a4605ed4ff96a908e1f5e822d1bb (patch) | |
| tree | 36b0a66b81fc201a426171e190975289640cd579 /lib/envelope.ml | |
| parent | d3708bb28adcd0220142f1890ab96bfd2df637d3 (diff) | |
| download | Sakura-fdc63e730f91a4605ed4ff96a908e1f5e822d1bb.tar.gz Sakura-fdc63e730f91a4605ed4ff96a908e1f5e822d1bb.zip | |
New Server & Manipulation refactor
Co-authored-by: Estevan Castilho <tevo@riajuu.net>
Diffstat (limited to '')
| -rw-r--r-- | lib/envelope.ml | 16 |
1 files changed, 8 insertions, 8 deletions
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) |
