package ppx_here

All checked builds pass
  1. Overview
  2. Docs

Description

Part of the Jane Street's PPX rewriters collection.

Added to opam-repository:

README

ppx_here

A ppx rewriter that defines an extension node whose value is its source position.

Syntax

ppx_here rewrites the extension [%here] in expressions, by replacing it by a value of type Source_code_position.t (i.e. Lexing.position) corresponding to the current position. It respects line number directives.

For instance:

let _ =
  print_endline [%here].Lexing.pos_fname

becomes:

let _ =
  print_endline
    {
      Lexing.pos_fname = ppx/ppx_here/test/test.ml";
      pos_lnum = 2;
      pos_cnum = 26;
      pos_bol = 8;
    }.Lexing.pos_fname

Usage

This is normally used so exceptions can contain better positions. An example is Core.Option.value_exn, which takes an optional position so that if you have a stack trace, you can get still the origin of the exception.

It can also be used in cases where stack traces are useless (for instance in monads with a complicated control flow).

Command line flag

If the flag -dirname <dir> is given, relative filenames are made relative to <dir>. <dir> can be a relative path.

<dir> can be chosen as the path from the root of the repository to the directory of the source, to make filenames unique within the repository (which avoids ambiguities as there can be many files called server.ml, common.ml or config.ml).

Dependencies (4)

  1. ppxlib >= "0.28.0"
  2. dune >= "3.11.0"
  3. base >= "v0.17" & < "v0.18~"
  4. ocaml >= "5.1.0"

Dev Dependencies

None

Optional Dependencies

None

Used by (33)

  1. arrayjit >= "0.5.2"
  2. bonsai >= "v0.17.0"
  3. cmdlang-to-base < "0.0.10"
  4. cohttp-eio >= "6.0.0~beta2"
  5. colibri2
  6. conduit-async >= "5.1.0"
  7. crs < "0.0.20260307"
  8. dap
  9. dunolint
  10. dunolint-lib < "0.0.20250804"
  11. gopcaml-mode-merlin < "0.0.6"
  12. h1_parser
  13. http
  14. neural_nets_lib >= "0.5.2"
  15. nuscr >= "2.1.0"
  16. obeam >= "0.1.0"
  17. pa_ppx >= "0.14"
  18. ppx_assert >= "v0.17.0"
  19. ppx_bap < "v0.14.0"
  20. ppx_bin_prot >= "v0.17.0"
  21. ppx_css >= "v0.17.0"
  22. ppx_expect >= "v0.17.0"
  23. ppx_jane >= "v0.17.0"
  24. ppx_let >= "v0.17.0"
  25. ppx_log >= "v0.17.0"
  26. ppx_quick_test
  27. ppx_sexp_message >= "v0.17.0"
  28. ppx_sexp_value >= "v0.17.0"
  29. timmy
  30. timmy-jsoo >= "1.1.5"
  31. timmy-lwt
  32. toplevel_backend >= "v0.17.0"
  33. volgo-base < "0.0.22"

Conflicts

None

Build status

Results of building ppx_here with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
v0.17.0 (this version) n/a n/a good good good
v0.16.0 n/a good good good good
v0.15.0 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure