package ppx_diff
A PPX rewriter that genreates the implementation of [Ldiffable.S].
Install
Dune Dependency
Authors
Maintainers
Sources
v0.17.1.tar.gz
md5=cfec5d638a1bf1ea77707d10eed5d2d7
sha512=5848274cb0c5acd1ee3f29318e6111c5fef4b357aeda78120e0370067b9b23f62bb57e1e0be948c3af385b5900a3e0fb657f26dd4fe7ee95cd7002b9d8b68547
doc/src/ppx_diff.diffable/optional_diff.ml.html
Source file optional_diff.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 58 59 60 61
module Diff = struct type 'a t = { diff : 'a } [@@unboxed] end type 'a t = 'a Diff.t option let none = None let[@inline] return diff = Some { Diff.diff } let[@inline] map t ~f = match t with | Some { Diff.diff } -> Some { Diff.diff = (f [@inlined hint]) diff } | None -> None ;; let[@inline] bind t ~f = match t with | Some { Diff.diff } -> (f [@inlined hint]) diff | None -> None ;; let both = `both_would_allocate__use_bind_instead let[@inline] ( >>| ) x f = map x ~f let[@inline] ( >>= ) x f = bind x ~f module Optional_syntax = struct module Optional_syntax = struct let[@inline] is_none t = match t with | None -> true | Some _ -> false ;; let[@inline] unsafe_value t = match t with | Some { Diff.diff } -> diff | None -> failwith "[Optional_diff.unsafe_value] called on [Optional_diff.none]" ;; end end include Optional_syntax.Optional_syntax let[@inline] to_option t = match t with | None -> None | Some { Diff.diff } -> Some diff ;; module Let_syntax = struct let return = return module Let_syntax = struct let return = return let map = map let bind = bind let both = both module Open_on_rhs = struct end end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>