-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Kakadu edited this page Jul 8, 2016
·
1 revision
Welcome to the generic-transformers wiki!
➜ gt-new git:(master) ✗ cat a.ml
@type 'a list = Nil | Cons of 'a * 'a list;;
➜ gt-new git:(master) ✗ make camlp5
make: Nothing to be done for 'camlp5'.
➜ gt-new git:(master) ✗ camlp5o camlp5/pa_gt.cmo pr_o.cmo a.ml
type 'a list =
Nil
| Cons of 'a * 'a list
class type virtual ['a, 'ia, 'sa, 'inh, 'syn] list_tt =
object
method c_Nil :
'inh -> ('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a -> 'syn
method c_Cons :
'inh -> ('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a ->
('ia, 'a, 'sa, < a : 'ia -> 'a -> 'sa >) GT.a ->
('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a -> 'syn
method t_list : ('ia -> 'a -> 'sa) -> 'inh -> 'a list -> 'syn
end
let (list :
(('ia -> 'a -> 'sa) -> ('a, 'ia, 'sa, 'inh, 'syn) #list_tt -> 'inh ->
'a list -> 'syn, unit)
GT.t) =
let rec list_gcata fa trans inh subj =
let rec self = list_gcata fa trans
and tpo = object method a = fa end in
match subj with
Nil -> trans#c_Nil inh (GT.make self subj tpo)
| Cons (p0, p1) ->
trans#c_Cons inh (GT.make self subj tpo) (GT.make fa p0 tpo)
(GT.make self p1 tpo)
in
{GT.gcata = list_gcata; GT.plugins = ()}
class virtual ['a, 'ia, 'sa, 'inh, 'syn] list_t =
object (this)
method virtual c_Nil :
'inh -> ('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a -> 'syn
method virtual c_Cons :
'inh -> ('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a ->
('ia, 'a, 'sa, < a : 'ia -> 'a -> 'sa >) GT.a ->
('inh, 'a list, 'syn, < a : 'ia -> 'a -> 'sa >) GT.a -> 'syn
method t_list fa = GT.transform list fa this
end
let (list :
(('ia -> 'a -> 'sa) -> ('a, 'ia, 'sa, 'inh, 'syn) #list_tt -> 'inh ->
'a list -> 'syn, < >)
GT.t) =
{GT.gcata = list.GT.gcata; GT.plugins = object end}
➜ gt-new git:(master) ✗