only write ghc pragma when writing to a file
authorhaftmann
Tue, 07 Sep 2010 16:49:32 +0200
changeset 394391ca9055ba1f7
parent 39438 fc1e02735438
child 39440 985b13c5a61d
only write ghc pragma when writing to a file
src/Tools/Code/code_haskell.ML
     1.1 --- a/src/Tools/Code/code_haskell.ML	Tue Sep 07 16:37:23 2010 +0200
     1.2 +++ b/src/Tools/Code/code_haskell.ML	Tue Sep 07 16:49:32 2010 +0200
     1.3 @@ -329,8 +329,7 @@
     1.4        map (fn (name, _) => str ("import qualified " ^ name ^ ";")) includes;
     1.5      fun print_module_frame module_name ps =
     1.6        (module_name, Pretty.chunks2 (
     1.7 -        str "{-# OPTIONS_GHC -fglasgow-exts #-}"
     1.8 -        :: str ("module " ^ module_name ^ " where {")
     1.9 +        str ("module " ^ module_name ^ " where {")
    1.10          :: ps
    1.11          @| str "}"
    1.12        ));
    1.13 @@ -355,7 +354,10 @@
    1.14              val filepath = (Path.append destination o Path.ext "hs" o Path.explode o implode
    1.15                o separate "/" o Long_Name.explode) module_name;
    1.16              val _ = File.mkdir_leaf (Path.dir filepath);
    1.17 -          in File.write filepath (format [] width content) end
    1.18 +          in
    1.19 +            (File.write filepath o format [] width o Pretty.chunks2)
    1.20 +              [str "{-# OPTIONS_GHC -fglasgow-exts #-}", content]
    1.21 +          end
    1.22        | write_module width NONE (_, content) = writeln (format [] width content);
    1.23    in
    1.24      Code_Target.serialization