pellest/src/syntax.ml

17 lines
412 B
OCaml
Raw Normal View History

2022-12-04 22:42:55 +01:00
let ( let* ) o f = Result.fold ~ok:f ~error:Result.error o
type extended_status =
[ Dream.status
| `See_Other_Redirect of (string * string) list
]
let ( let** ) o f =
match o with
| Error (kind, msg) -> begin
match kind with
| `See_Other_Redirect headers ->
Dream.respond ~status:`See_Other ~headers msg
| #Dream.status as status -> Template.err (status, msg)
end
| Ok v -> f v