10 val print_value: value -> string |
10 val print_value: value -> string |
11 val print_type: value -> string |
11 val print_type: value -> string |
12 type 'a T |
12 type 'a T |
13 val name_of: 'a T -> string |
13 val name_of: 'a T -> string |
14 val pos_of: 'a T -> Position.T |
14 val pos_of: 'a T -> Position.T |
|
15 val apply: 'a T -> Proof.context -> 'a |
15 val get: Proof.context -> 'a T -> 'a |
16 val get: Proof.context -> 'a T -> 'a |
16 val map: 'a T -> ('a -> 'a) -> Proof.context -> Proof.context |
17 val map: 'a T -> ('a -> 'a) -> Proof.context -> Proof.context |
17 val put: 'a T -> 'a -> Proof.context -> Proof.context |
18 val put: 'a T -> 'a -> Proof.context -> Proof.context |
18 val restore: 'a T -> Proof.context -> Proof.context -> Proof.context |
19 val restore: 'a T -> Proof.context -> Proof.context -> Proof.context |
|
20 val apply_global: 'a T -> theory -> 'a |
19 val get_global: theory -> 'a T -> 'a |
21 val get_global: theory -> 'a T -> 'a |
20 val map_global: 'a T -> ('a -> 'a) -> theory -> theory |
22 val map_global: 'a T -> ('a -> 'a) -> theory -> theory |
21 val put_global: 'a T -> 'a -> theory -> theory |
23 val put_global: 'a T -> 'a -> theory -> theory |
22 val restore_global: 'a T -> theory -> theory -> theory |
24 val restore_global: 'a T -> theory -> theory -> theory |
|
25 val apply_generic: 'a T -> Context.generic -> 'a |
23 val get_generic: Context.generic -> 'a T -> 'a |
26 val get_generic: Context.generic -> 'a T -> 'a |
24 val map_generic: 'a T -> ('a -> 'a) -> Context.generic -> Context.generic |
27 val map_generic: 'a T -> ('a -> 'a) -> Context.generic -> Context.generic |
25 val put_generic: 'a T -> 'a -> Context.generic -> Context.generic |
28 val put_generic: 'a T -> 'a -> Context.generic -> Context.generic |
26 val restore_generic: 'a T -> Context.generic -> Context.generic -> Context.generic |
29 val restore_generic: 'a T -> Context.generic -> Context.generic -> Context.generic |
27 val bool: value T -> bool T |
30 val bool: value T -> bool T |
90 map_value: ('a -> 'a) -> Context.generic -> Context.generic}; |
93 map_value: ('a -> 'a) -> Context.generic -> Context.generic}; |
91 |
94 |
92 fun name_of (Config {name, ...}) = name; |
95 fun name_of (Config {name, ...}) = name; |
93 fun pos_of (Config {pos, ...}) = pos; |
96 fun pos_of (Config {pos, ...}) = pos; |
94 |
97 |
95 fun get_generic context (Config {get_value, ...}) = get_value context; |
98 fun apply_generic (Config {get_value, ...}) = get_value; |
|
99 fun get_generic context config = apply_generic config context; |
96 fun map_generic (Config {map_value, ...}) f context = map_value f context; |
100 fun map_generic (Config {map_value, ...}) f context = map_value f context; |
97 fun put_generic config value = map_generic config (K value); |
101 fun put_generic config value = map_generic config (K value); |
98 fun restore_generic config context = put_generic config (get_generic context config); |
102 fun restore_generic config = put_generic config o apply_generic config; |
99 |
103 |
|
104 fun apply_ctxt config = apply_generic config o Context.Proof; |
100 fun get_ctxt ctxt = get_generic (Context.Proof ctxt); |
105 fun get_ctxt ctxt = get_generic (Context.Proof ctxt); |
101 fun map_ctxt config f = Context.proof_map (map_generic config f); |
106 fun map_ctxt config f = Context.proof_map (map_generic config f); |
102 fun put_ctxt config value = map_ctxt config (K value); |
107 fun put_ctxt config value = map_ctxt config (K value); |
103 fun restore_ctxt config ctxt = put_ctxt config (get_ctxt ctxt config); |
108 fun restore_ctxt config = put_ctxt config o apply_ctxt config; |
104 |
109 |
|
110 fun apply_global config = apply_generic config o Context.Theory; |
105 fun get_global thy = get_generic (Context.Theory thy); |
111 fun get_global thy = get_generic (Context.Theory thy); |
106 fun map_global config f = Context.theory_map (map_generic config f); |
112 fun map_global config f = Context.theory_map (map_generic config f); |
107 fun put_global config value = map_global config (K value); |
113 fun put_global config value = map_global config (K value); |
108 fun restore_global config thy = put_global config (get_global thy config); |
114 fun restore_global config = put_global config o apply_global config; |
109 |
115 |
110 |
116 |
111 (* coerce type *) |
117 (* coerce type *) |
112 |
118 |
113 fun coerce make dest (Config {name, pos, get_value, map_value}) = Config |
119 fun coerce make dest (Config {name, pos, get_value, map_value}) = Config |
172 val declare_option_int = int o declare_option; |
178 val declare_option_int = int o declare_option; |
173 val declare_option_real = real o declare_option; |
179 val declare_option_real = real o declare_option; |
174 val declare_option_string = string o declare_option; |
180 val declare_option_string = string o declare_option; |
175 |
181 |
176 (*final declarations of this structure!*) |
182 (*final declarations of this structure!*) |
|
183 val apply = apply_ctxt; |
177 val get = get_ctxt; |
184 val get = get_ctxt; |
178 val map = map_ctxt; |
185 val map = map_ctxt; |
179 val put = put_ctxt; |
186 val put = put_ctxt; |
180 val restore = restore_ctxt; |
187 val restore = restore_ctxt; |
181 |
188 |