aboutsummaryrefslogtreecommitdiffstats
path: root/lib/envelope.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-04-20 21:55:07 -0300
committerGitHub <noreply@github.com>2026-04-20 21:55:07 -0300
commitfdc63e730f91a4605ed4ff96a908e1f5e822d1bb (patch)
tree36b0a66b81fc201a426171e190975289640cd579 /lib/envelope.ml
parentd3708bb28adcd0220142f1890ab96bfd2df637d3 (diff)
downloadSakura-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.ml16
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)