File: monomorphic.ml

package info (click to toggle)
ocaml-visitors 20200210-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,896 kB
  • sloc: ml: 4,077; makefile: 44; sh: 18
file content (11 lines) | stat: -rw-r--r-- 297 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
type 'a t =
  | Leaf of 'a
  | Node of 'a t * ('a * 'a) t
[@@deriving visitors { variety = "map"; monomorphic = ["'env"] }]

let o = object
  inherit [_] map
  method! visit_Leaf visit_'a env x =
    let env = (env : int) in (* check that ['env] is not quantified *)
    Leaf (visit_'a env x)
end