package zanuda

  1. Overview
  2. Docs
Linter for OCaml+dune projects

Install

Dune Dependency

Authors

Maintainers

Sources

v1.1.0.tar.gz
sha256=5b7deabdb016858a0e19ddfb7647f628a243065f88c5ae9f4c362500d51cea7a
sha512=ceb852103fbbb88b5eeb8130bc7aa8bffe7130df6645d3298e1bb9b8f7e8f6c7b323ccc474cf92a08d28e7b80e9a96d68fd53de2e51c7c0e7d8e3e82e436b4bc

doc/src/zanuda.tast_pattern/My_printtyped.ml.html

Source file My_printtyped.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
62
(** These extra functions are an extension of {!Printtyped} module from compiler libs.
    Maybe in new versions of compiler they will be available out of box. *)

[@@@ocaml.text "/*"]

(** Copyright 2021-2024, Kakadu. *)

(** SPDX-License-Identifier: LGPL-3.0-or-later *)

[@@@ocaml.text "/*"]

[@@@coverage off]

(* This are helper functions related to OCaml compiler. Doesn't make sense to seriously test them *)

include Printtyped

[%%if ocaml_version < (4, 11, 0)]

let untype_expression = default_mapper.expr default_mapper

[%%endif]

(** {2 New functions} *)

let expr ppf e =
  let open Typedtree in
  implementation
    ppf
    { str_items =
        [ { str_desc = Tstr_eval (e, []); str_loc = e.exp_loc; str_env = e.exp_env } ]
    ; str_final_env = e.exp_env
    ; str_type = []
    }
;;

let me ppf me =
  let open Typedtree in
  implementation
    ppf
    { str_items =
        [ { str_desc =
              Tstr_module
                { mb_id = None
                ; mb_name = Location.mknoloc None
                ; mb_expr = me
                ; mb_attributes = []
                ; mb_presence = Types.Mp_present
                ; mb_loc = me.mod_loc
                }
          ; str_loc = me.mod_loc
          ; str_env = me.mod_env
          }
        ]
    ; str_final_env = me.mod_env
    ; str_type = []
    }
;;

let attrs ppf attrs =
  Pprintast.expression ppf (Ast_helper.Exp.constant (Pconst_integer ("1", None)) ~attrs)
;;
OCaml

Innovation. Community. Security.