5 data Package = Package {
6 import_dirs :: [String],
7 library_dirs :: [String],
11 package_deps :: [String],
12 extra_ghc_opts :: String,
13 extra_cc_opts :: String,
14 extra_ld_opts :: String
18 listPkgs :: [(String,Package)] -> String
19 listPkgs pkgs = render (fsep (punctuate comma (map (text . fst) pkgs)))
21 dumpPackages :: [(String,Package)] -> String
23 render (brackets (vcat (punctuate comma (map dumpPkg pkgs))))
25 dumpPkg (name, pkg) = parens (hang (text (show name) <> comma)
29 { import_dirs = import_dirs
30 , library_dirs = library_dirs
31 , libraries = libraries
32 , include_dir = include_dir
33 , c_include = c_include
34 , package_deps = package_deps
35 , extra_ghc_opts = extra_ghc_opts
36 , extra_cc_opts = extra_cc_opts
37 , extra_ld_opts = extra_ld_opts })
38 = text "Package" $$ nest 3 (braces (
39 sep (punctuate comma [
40 hang (text "import_dirs =" ) 2 (pprStrs import_dirs),
41 hang (text "library_dirs = " ) 2 (pprStrs library_dirs),
42 hang (text "libraries = " ) 2 (pprStrs libraries),
43 hang (text "include_dir = " ) 2 (text (show include_dir)),
44 hang (text "c_include = " ) 2 (text (show c_include)),
45 hang (text "package_deps = " ) 2 (pprStrs package_deps),
46 hang (text "extra_ghc_opts = " ) 2 (text (show extra_ghc_opts)),
47 hang (text "extra_cc_opts = " ) 2 (text (show extra_cc_opts)),
48 hang (text "extra_ld_opts = " ) 2 (text (show extra_ld_opts))
51 pprStrs strs = brackets (sep (punctuate comma (map (text . show) strs)))