equal
deleted
inserted
replaced
336 fun register_code new_tycos new_consts ctxt = |
336 fun register_code new_tycos new_consts ctxt = |
337 let |
337 let |
338 val ((tycos, consts), _) = Code_Antiq_Data.get ctxt; |
338 val ((tycos, consts), _) = Code_Antiq_Data.get ctxt; |
339 val tycos' = fold (insert (op =)) new_tycos tycos; |
339 val tycos' = fold (insert (op =)) new_tycos tycos; |
340 val consts' = fold (insert (op =)) new_consts consts; |
340 val consts' = fold (insert (op =)) new_consts consts; |
341 val program = Code_Thingol.consts_program (Proof_Context.theory_of ctxt) consts'; |
341 val program = Code_Thingol.consts_program ctxt consts'; |
342 val acc_code = Lazy.lazy (fn () => |
342 val acc_code = Lazy.lazy (fn () => |
343 evaluation_code ctxt structure_generated program tycos' consts' |
343 evaluation_code ctxt structure_generated program tycos' consts' |
344 |> apsnd snd); |
344 |> apsnd snd); |
345 in Code_Antiq_Data.put ((tycos', consts'), (false, acc_code)) ctxt end; |
345 in Code_Antiq_Data.put ((tycos', consts'), (false, acc_code)) ctxt end; |
346 |
346 |
438 (prep_type ctxt raw_tyco, (Option.map o map) (prep_const thy) raw_cos)) raw_datatypes; |
438 (prep_type ctxt raw_tyco, (Option.map o map) (prep_const thy) raw_cos)) raw_datatypes; |
439 val (tycos, constrs) = map_split (uncurry (check_datatype thy)) datatypes |
439 val (tycos, constrs) = map_split (uncurry (check_datatype thy)) datatypes |
440 |> apsnd flat; |
440 |> apsnd flat; |
441 val functions = map (prep_const thy) raw_functions; |
441 val functions = map (prep_const thy) raw_functions; |
442 val consts = constrs @ functions; |
442 val consts = constrs @ functions; |
443 val program = Code_Thingol.consts_program (Proof_Context.theory_of ctxt) consts; |
443 val program = Code_Thingol.consts_program ctxt consts; |
444 val result = evaluation_code ctxt module_name program tycos consts |
444 val result = evaluation_code ctxt module_name program tycos consts |
445 |> (apsnd o apsnd) (chop (length constrs)); |
445 |> (apsnd o apsnd) (chop (length constrs)); |
446 in |
446 in |
447 thy |
447 thy |
448 |> process_reflection result module_name some_file |
448 |> process_reflection result module_name some_file |