src/Pure/Isar/isar_thy.ML
changeset 7960 d5c91c131070
parent 7953 955fde69fa7b
child 8079 ccfc64f29333
     1.1 --- a/src/Pure/Isar/isar_thy.ML	Thu Oct 28 13:55:17 1999 +0200
     1.2 +++ b/src/Pure/Isar/isar_thy.ML	Thu Oct 28 14:00:25 1999 +0200
     1.3 @@ -158,7 +158,7 @@
     1.4    val kill_theory: string -> unit
     1.5    val theory: string * string list * (string * bool) list
     1.6      -> Toplevel.transition -> Toplevel.transition
     1.7 -  val init_context: (string -> unit) -> string -> Toplevel.transition -> Toplevel.transition
     1.8 +  val init_context: ('a -> unit) -> 'a -> Toplevel.transition -> Toplevel.transition
     1.9    val context: string -> Toplevel.transition -> Toplevel.transition
    1.10  end;
    1.11  
    1.12 @@ -537,8 +537,12 @@
    1.13  
    1.14  (* context switch *)
    1.15  
    1.16 -fun init_context (f: string -> unit) name =
    1.17 -  Toplevel.init_theory (fn _ => (the (#2 (Context.pass None f name)))) (K ()) (K ());
    1.18 +fun fetch_context f x =
    1.19 +  (case Context.pass None f x of
    1.20 +    ((), None) => raise Toplevel.UNDEF
    1.21 +  | ((), Some thy) => thy);
    1.22 +
    1.23 +fun init_context f x = Toplevel.init_theory (fn _ => fetch_context f x) (K ()) (K ());
    1.24  
    1.25  val context = init_context (ThyInfo.quiet_update_thy true);
    1.26