src/Pure/ML/ml_context.ML
changeset 53171 a5e54d4d9081
parent 53169 e2d31807cbf6
child 55526 39708e59f4b0
equal deleted inserted replaced
53170:96f7adb55d72 53171:a5e54d4d9081
    72 
    72 
    73 fun ml_store get (name, ths) =
    73 fun ml_store get (name, ths) =
    74   let
    74   let
    75     val ths' = Context.>>> (Context.map_theory_result
    75     val ths' = Context.>>> (Context.map_theory_result
    76       (Global_Theory.store_thms (Binding.name name, ths)));
    76       (Global_Theory.store_thms (Binding.name name, ths)));
    77     val _ = Context.>> (Context.map_theory (Stored_Thms.put ths'));
    77     val _ = Theory.setup (Stored_Thms.put ths');
    78     val _ =
    78     val _ =
    79       if name = "" then ()
    79       if name = "" then ()
    80       else if not (ML_Syntax.is_identifier name) then
    80       else if not (ML_Syntax.is_identifier name) then
    81         error ("Cannot bind theorem(s) " ^ quote name ^ " as ML value")
    81         error ("Cannot bind theorem(s) " ^ quote name ^ " as ML value")
    82       else
    82       else
    83         ML_Compiler.eval true Position.none
    83         ML_Compiler.eval true Position.none
    84           (ML_Lex.tokenize ("val " ^ name ^ " = " ^ get ^ " ();"));
    84           (ML_Lex.tokenize ("val " ^ name ^ " = " ^ get ^ " ();"));
    85     val _ = Context.>> (Context.map_theory (Stored_Thms.put []));
    85     val _ = Theory.setup (Stored_Thms.put []);
    86   in () end;
    86   in () end;
    87 
    87 
    88 val ml_store_thms = ml_store "ML_Context.get_stored_thms";
    88 val ml_store_thms = ml_store "ML_Context.get_stored_thms";
    89 fun ml_store_thm (name, th) = ml_store "ML_Context.get_stored_thm" (name, [th]);
    89 fun ml_store_thm (name, th) = ml_store "ML_Context.get_stored_thm" (name, [th]);
    90 
    90