327 modules = modules} thy |
327 modules = modules} thy |
328 | SOME _ => error ("Constant " ^ cname ^ " already associated with code") |
328 | SOME _ => error ("Constant " ^ cname ^ " already associated with code") |
329 end; |
329 end; |
330 |
330 |
331 val assoc_const_i = gen_assoc_const (K I); |
331 val assoc_const_i = gen_assoc_const (K I); |
332 val assoc_const = gen_assoc_const Code_Unit.read_bare_const; |
332 val assoc_const = gen_assoc_const Code.read_bare_const; |
333 |
333 |
334 |
334 |
335 (**** associate types with target language types ****) |
335 (**** associate types with target language types ****) |
336 |
336 |
337 fun assoc_type (s, syn) thy = |
337 fun assoc_type (s, syn) thy = |
887 (Pretty.block [str "val () = Codegen.test_fn :=", |
887 (Pretty.block [str "val () = Codegen.test_fn :=", |
888 Pretty.brk 1, str ("(fn i =>"), Pretty.brk 1, |
888 Pretty.brk 1, str ("(fn i =>"), Pretty.brk 1, |
889 mk_let (map (fn ((s, T), s') => |
889 mk_let (map (fn ((s, T), s') => |
890 (mk_tuple [str s', str (s' ^ "_t")], |
890 (mk_tuple [str s', str (s' ^ "_t")], |
891 Pretty.block [mk_gen gr "Generated" false [] "" T, Pretty.brk 1, |
891 Pretty.block [mk_gen gr "Generated" false [] "" T, Pretty.brk 1, |
892 str "(i + 1)"])) frees') |
892 str "i"])) frees') |
893 (Pretty.block [str "if ", |
893 (Pretty.block [str "if ", |
894 mk_app false (str "testf") (map (str o snd) frees'), |
894 mk_app false (str "testf") (map (str o snd) frees'), |
895 Pretty.brk 1, str "then NONE", |
895 Pretty.brk 1, str "then NONE", |
896 Pretty.brk 1, str "else ", |
896 Pretty.brk 1, str "else ", |
897 Pretty.block [str "SOME ", Pretty.block (str "[" :: |
897 Pretty.block [str "SOME ", Pretty.block (str "[" :: |