package current
Pipeline language for keeping things up-to-date
Install
Dune Dependency
Authors
Maintainers
Sources
current-v0.5.tbz
sha256=f8c884318a46a568d965c7e8bac00dfe2339efac04ca6f0cbabef916d8b917ca
sha512=e0633239a7d02cdde6264db96c39ed7e3d1adf3a7f09bb25ad002d388f203b561e8c808daee90539bc0ee15c547d2ab4bef1789dcc9c22ed00b151bad0083f64
doc/src/current.term/dyn.ml.html
Source file dyn.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
type 'a t = ('a, Id.t * [`Active of Output.active | `Msg of string]) result let return x = Ok x let fail ~id msg = Error (id, `Msg msg) let strip_id = function | Ok x -> Ok x | Error (_, e) -> Error e let state x = Ok (strip_id x) let catch = function | Ok _ as x -> Ok x | Error (_, (`Msg _ as x)) -> Ok (Error x) | Error (_, `Active _) as x -> x let msg_of_exn = function | Failure m -> m | ex -> Printexc.to_string ex let bind x f = match x with | Error _ as e -> e | Ok y -> f y let map ~id f x = match x with | Error _ as e -> e | Ok y -> match f y with | y -> Ok y | exception ex -> Error (id, `Msg (msg_of_exn ex)) let map_error ~id f x = match x with | Error (_, `Msg m) -> let m = try f m with ex -> msg_of_exn ex in Error (id, `Msg m) | _ -> x let pair a b = match a, b with | (Error (_, `Msg _) as e), _ | _, (Error (_, `Msg _) as e) -> e | (Error (_, `Active _) as e), _ | _, (Error (_, `Active _) as e) -> e | Ok x, Ok y -> Ok (x, y) let active ~id a = Error (id, `Active a) let run = strip_id let pp ok f = function | Ok x -> ok f x | Error (_, `Active `Ready) -> Fmt.string f "(ready)" | Error (_, `Active `Running) -> Fmt.string f "(running)" | Error (_, `Msg m) -> Fmt.pf f "FAILED: %s" m
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>