src/Tools/Code/code_haskell.ML
changeset 38910 6af1d8673cbf
parent 38863 9070a7c356c9
child 38911 caba168a3039
equal deleted inserted replaced
38909:919c924067f3 38910:6af1d8673cbf
   314   in (deresolver, hs_program) end;
   314   in (deresolver, hs_program) end;
   315 
   315 
   316 fun serialize_haskell module_prefix module_name string_classes labelled_name
   316 fun serialize_haskell module_prefix module_name string_classes labelled_name
   317     raw_reserved includes module_alias
   317     raw_reserved includes module_alias
   318     syntax_class syntax_tyco syntax_const (code_of_pretty, code_writeln) program
   318     syntax_class syntax_tyco syntax_const (code_of_pretty, code_writeln) program
   319     (stmt_names, presentation_stmt_names) destination =
   319     (stmt_names, presentation_stmt_names) width =
   320   let
   320   let
   321     val reserved = fold (insert (op =) o fst) includes raw_reserved;
   321     val reserved = fold (insert (op =) o fst) includes raw_reserved;
   322     val (deresolver, hs_program) = haskell_program_of_program labelled_name
   322     val (deresolver, hs_program) = haskell_program_of_program labelled_name
   323       module_prefix reserved module_alias program;
   323       module_prefix reserved module_alias program;
   324     val contr_classparam_typs = Code_Thingol.contr_classparam_typs program;
   324     val contr_classparam_typs = Code_Thingol.contr_classparam_typs program;
   388       in File.write pathname
   388       in File.write pathname
   389         ("{-# OPTIONS_GHC -fglasgow-exts #-}\n\n"
   389         ("{-# OPTIONS_GHC -fglasgow-exts #-}\n\n"
   390           ^ code_of_pretty content)
   390           ^ code_of_pretty content)
   391       end
   391       end
   392   in
   392   in
   393     Code_Target.mk_serialization target
   393     Code_Target.mk_serialization
   394       (fn NONE => K () o map (code_writeln o (fn p => Pretty.block [p, Pretty.fbrk]) o snd)
   394       (fn width => (fn NONE => K () o map (code_writeln o (fn p => Pretty.block [p, Pretty.fbrk]) o snd)
   395         | SOME file => K () o map (write_module (check_destination file)))
   395         | SOME file => K () o map (write_module (check_destination file))))
   396       (rpair [] o cat_lines o map (code_of_pretty o snd))
   396       (fn width => (rpair [] o cat_lines o map (code_of_pretty o snd)))
   397       (map (uncurry print_module) includes
   397       (map (uncurry print_module) includes
   398         @ map serialize_module (Symtab.dest hs_program))
   398         @ map serialize_module (Symtab.dest hs_program))
   399       destination
   399       width
   400   end;
   400   end;
   401 
   401 
   402 val literals = let
   402 val literals = let
   403   fun char_haskell c =
   403   fun char_haskell c =
   404     let
   404     let