package ppxlib

  1. Overview
  2. Docs
Standard infrastructure for ppx rewriters

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ppxlib-0.37.0.tbz
sha256=2e223837e7cecc3bc84a432432c0a72f4e1d5be9165c9c33772f156db85db0b3
sha512=78c62c6de7a641b950de9b4b744841c8823918c545046693e291077adfcd069a812094c11d8d51f792c0b5f340307d38f452ff0a92520df63ed17a3ca9922e2e

doc/src/ppxlib.astlib/stdlib0.ml.html

Source file stdlib0.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Int = struct
  let to_string = string_of_int
end

module Option = struct
  let map f o = match o with None -> None | Some v -> Some (f v)
end

module String = struct
  let is_prefix t ~prefix =
    let rec is_prefix_from t ~prefix ~pos ~len =
      pos >= len
      || Char.equal (String.get t pos) (String.get prefix pos)
         && is_prefix_from t ~prefix ~pos:(pos + 1) ~len
    in
    String.length t >= String.length prefix
    && is_prefix_from t ~prefix ~pos:0 ~len:(String.length prefix)
end