equal
deleted
inserted
replaced
327 (* print modules *) |
327 (* print modules *) |
328 val import_includes_ps = |
328 val import_includes_ps = |
329 map (fn (name, _) => str ("import qualified " ^ name ^ ";")) includes; |
329 map (fn (name, _) => str ("import qualified " ^ name ^ ";")) includes; |
330 fun print_module_frame module_name ps = |
330 fun print_module_frame module_name ps = |
331 (module_name, Pretty.chunks2 ( |
331 (module_name, Pretty.chunks2 ( |
332 str "{-# OPTIONS_GHC -fglasgow-exts #-}" |
332 str ("module " ^ module_name ^ " where {") |
333 :: str ("module " ^ module_name ^ " where {") |
|
334 :: ps |
333 :: ps |
335 @| str "}" |
334 @| str "}" |
336 )); |
335 )); |
337 fun print_module module_name (gr, imports) = |
336 fun print_module module_name (gr, imports) = |
338 let |
337 let |
353 let |
352 let |
354 val _ = File.check destination; |
353 val _ = File.check destination; |
355 val filepath = (Path.append destination o Path.ext "hs" o Path.explode o implode |
354 val filepath = (Path.append destination o Path.ext "hs" o Path.explode o implode |
356 o separate "/" o Long_Name.explode) module_name; |
355 o separate "/" o Long_Name.explode) module_name; |
357 val _ = File.mkdir_leaf (Path.dir filepath); |
356 val _ = File.mkdir_leaf (Path.dir filepath); |
358 in File.write filepath (format [] width content) end |
357 in |
|
358 (File.write filepath o format [] width o Pretty.chunks2) |
|
359 [str "{-# OPTIONS_GHC -fglasgow-exts #-}", content] |
|
360 end |
359 | write_module width NONE (_, content) = writeln (format [] width content); |
361 | write_module width NONE (_, content) = writeln (format [] width content); |
360 in |
362 in |
361 Code_Target.serialization |
363 Code_Target.serialization |
362 (fn width => fn destination => K () o map (write_module width destination)) |
364 (fn width => fn destination => K () o map (write_module width destination)) |
363 (fn present => fn width => rpair (fn _ => error "no deresolving") |
365 (fn present => fn width => rpair (fn _ => error "no deresolving") |