diff options
author | Clombrong <cromblong@egregore.fun> | 2025-08-16 01:03:43 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-08-17 14:58:49 +0200 |
commit | e1d851acc39747c4d26662c2e53071a8243adc70 (patch) | |
tree | 001c93169749db4885bca8fcaa2113f35aea0a5a /lib/segment.ml | |
parent | ef054dfae34971a28811c5082a4b6041bdfe58dd (diff) |
feat(xml): tree fails in lwt-land directly
Diffstat (limited to 'lib/segment.ml')
-rw-r--r-- | lib/segment.ml | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/segment.ml b/lib/segment.ml index 7023098..b278c50 100644 --- a/lib/segment.ml +++ b/lib/segment.ml @@ -1,4 +1,4 @@ -open Lwt.Syntax +open Lwt.Infix open Markup open Xml @@ -15,8 +15,4 @@ let next (stream : (signal, async) stream) : (signal, sync) stream Lwt.t = (** [get stream] is a promise containing a single Xml element of [stream]. *) let get (stream : (signal, async) stream) : element Lwt.t = - let* signal = next stream in - let* el = tree signal - in match el with - | Some xml -> Lwt.return xml - | None -> Lwt.fail (InvalidStanza (signal |> write_xml |> to_string)) + next stream >>= tree |