File: test02.cppo.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 (33 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (4)
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
type term =
  | TUnit
  | TIntLiteral of int
  | TVar of string
  | TLambda of string * term
  | TApp of term * term
#if OCAML_VERSION >= (4, 03, 0)
  | TPair of { fst: term; snd: term }
#endif
  | TTuple of term_list

and term_list =
  | TLNil
  | TLCons of (term * term_list)

[@@deriving
     visitors { variety = "iter"; concrete = true },
     visitors { variety = "map"; concrete = true },
     visitors { variety = "reduce"; concrete = true; ancestors = ["VisitorsRuntime.addition_monoid"] },
     visitors { variety = "endo"; concrete = true },
     visitors { variety = "iter2"; concrete = true },
     visitors { variety = "map2"; concrete = true },
     visitors { variety = "reduce2"; concrete = true; ancestors = ["VisitorsRuntime.addition_monoid"] }
]

let identity : term =
  TLambda ("x", TVar "x")

let () =
  new iter#visit_term 33 identity

let () =
  new iter#visit_term 33 (new map#visit_term () identity)