test02.ml 888 Bytes
Newer Older
POTTIER Francois's avatar
POTTIER Francois committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
type term =
  | TUnit
  | TIntLiteral of int
  | TVar of string
  | TLambda of string * term
  | TApp of term * term
  | TPair of { fst: term; snd: term }
  | TTuple of term_list

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

[@@deriving
15 16
     visitors { variety = "iter"; concrete = true },
     visitors { variety = "map"; concrete = true },
17 18 19 20 21
     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"] }
POTTIER Francois's avatar
POTTIER Francois committed
22 23 24 25 26 27 28 29 30 31
]

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)