package eio
Effect-based direct-style IO API for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
eio-0.10.tbz
sha256=390f7814507b8133d6c25e3a67a742d731c7ca66252b287b1fb0e3ad4d10eecc
sha512=9c0c9088b178df9799aaae9deb803a802228f1329cbe452479c90e80a13985d9c364ea86ee14e4e759133940f9f6065c7e8ece509d176fb1e347c5320f00a494
doc/src/eio.core/debug.ml.html
Source file debug.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
type traceln = { traceln : 'a. ?__POS__:string * int * int * int -> ('a, Format.formatter, unit, unit) format4 -> 'a; } [@@unboxed] let traceln_key : traceln Fiber.key = Fiber.create_key () let traceln_mutex = Mutex.create () let default_traceln ?__POS__:pos fmt = let k go = let b = Buffer.create 512 in let f = Format.formatter_of_buffer b in go f; Option.iter (fun (file, lnum, _, _) -> Format.fprintf f " [%s:%d]" file lnum) pos; Format.pp_close_box f (); Format.pp_print_flush f (); let msg = Buffer.contents b in Ctf.label msg; let lines = String.split_on_char '\n' msg in Mutex.lock traceln_mutex; Fun.protect ~finally:(fun () -> Mutex.unlock traceln_mutex) @@ fun () -> List.iter (Printf.eprintf "+%s\n") lines; flush stderr in Format.kdprintf k ("@[" ^^ fmt) let traceln ?__POS__ fmt = let traceln = match Fiber.get traceln_key with | Some { traceln } -> traceln | None | exception (Effect.Unhandled _) -> default_traceln in traceln ?__POS__ fmt type t = < traceln : traceln Fiber.key; > let v = object method traceln = traceln_key end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>