src/Pure/Thy/context.ML
changeset 4486 48e4fbc03b7c
parent 4364 ab73573067d6
child 4843 df709de137af
equal deleted inserted replaced
4485:697972696f71 4486:48e4fbc03b7c
     3     Author:     Markus Wenzel, TU Muenchen
     3     Author:     Markus Wenzel, TU Muenchen
     4 
     4 
     5 Global contexts: session and theory.
     5 Global contexts: session and theory.
     6 *)
     6 *)
     7 
     7 
     8 signature CONTEXT =
     8 signature BASIC_CONTEXT =
     9 sig
     9 sig
    10   val get_session: unit -> string list
    10   val get_session: unit -> string list
    11   val add_session: string -> unit
    11   val add_session: string -> unit
    12   val reset_session: unit -> unit
    12   val reset_session: unit -> unit
    13   val get_context: unit -> theory
    13   val get_context: unit -> theory
    14   val context: theory -> unit
    14   val context: theory -> unit
    15   val reset_context: unit -> unit
    15   val reset_context: unit -> unit
       
    16 end;
       
    17 
       
    18 signature CONTEXT =
       
    19 sig
       
    20   include BASIC_CONTEXT
       
    21   val >> : (theory -> theory) -> unit
    16 end;
    22 end;
    17 
    23 
    18 structure Context: CONTEXT =
    24 structure Context: CONTEXT =
    19 struct
    25 struct
    20 
    26 
    39 
    45 
    40 fun context thy = current_theory := Some thy;
    46 fun context thy = current_theory := Some thy;
    41 fun reset_context () = current_theory := None;
    47 fun reset_context () = current_theory := None;
    42 
    48 
    43 
    49 
       
    50 nonfix >>;
       
    51 fun >> f = current_theory := Some (f (get_context ()));
       
    52 
       
    53 
    44 end;
    54 end;
    45 
    55 
    46 open Context;
    56 
       
    57 structure BasicContext: BASIC_CONTEXT = Context;
       
    58 open BasicContext;