src/Pure/context.ML
changeset 10914 aded4ba99b88
parent 10893 408906dd1e1b
child 10924 92305ae9f460
equal deleted inserted replaced
10913:57eb8c1d6f88 10914:aded4ba99b88
    20   val setmp: theory option -> ('a -> 'b) -> 'a -> 'b
    20   val setmp: theory option -> ('a -> 'b) -> 'a -> 'b
    21   val pass: theory option -> ('a -> 'b) -> 'a -> 'b * theory option
    21   val pass: theory option -> ('a -> 'b) -> 'a -> 'b * theory option
    22   val pass_theory: theory -> ('a -> 'b) -> 'a -> 'b * theory
    22   val pass_theory: theory -> ('a -> 'b) -> 'a -> 'b * theory
    23   val save: ('a -> 'b) -> 'a -> 'b
    23   val save: ('a -> 'b) -> 'a -> 'b
    24   val >> : (theory -> theory) -> unit
    24   val >> : (theory -> theory) -> unit
       
    25   val ml_output: (string -> unit) * (string -> unit)
    25   val use_mltext: string -> bool -> theory option -> unit
    26   val use_mltext: string -> bool -> theory option -> unit
    26   val use_mltext_theory: string -> bool -> theory -> theory
    27   val use_mltext_theory: string -> bool -> theory -> theory
    27   val use_let: string -> string -> string -> theory -> theory
    28   val use_let: string -> string -> string -> theory -> theory
    28   val use_setup: string -> theory -> theory
    29   val use_setup: string -> theory -> theory
    29 end;
    30 end;
    67 fun >> f = set_context (Some (f (the_context ())));
    68 fun >> f = set_context (Some (f (the_context ())));
    68 
    69 
    69 
    70 
    70 (* use ML text *)
    71 (* use ML text *)
    71 
    72 
    72 fun use_mltext txt verb opt_thy = setmp opt_thy (fn () => use_text priority verb txt) ();
    73 val ml_output = (writeln, error_msg: string -> unit);
    73 fun use_mltext_theory txt verb thy = #2 (pass_theory thy (use_text priority verb) txt);
    74 
       
    75 fun use_mltext txt verb opt_thy = setmp opt_thy (fn () => use_text ml_output verb txt) ();
       
    76 fun use_mltext_theory txt verb thy = #2 (pass_theory thy (use_text ml_output verb) txt);
    74 
    77 
    75 fun use_context txt = use_mltext_theory ("Context.>> (" ^ txt ^ ");") false;
    78 fun use_context txt = use_mltext_theory ("Context.>> (" ^ txt ^ ");") false;
    76 
    79 
    77 fun use_let bind body txt =
    80 fun use_let bind body txt =
    78   use_context ("let " ^ bind ^ " = " ^ txt ^ " in\n" ^ body ^ " end");
    81   use_context ("let " ^ bind ^ " = " ^ txt ^ " in\n" ^ body ^ " end");