Clean up code.
[hadrian.git] / src / Settings / Packages.hs
1 module Settings.Packages (getPackages, knownPackages, findKnownPackage) where
2
3 import Expression
4 import Predicates
5 import Settings.User
6
7 -- Combining default list of packages with user modifications
8 getPackages :: Expr [Package]
9 getPackages = fromDiffExpr $ defaultPackages <> userPackages
10
11 -- These are the packages we build by default
12 defaultPackages :: Packages
13 defaultPackages = mconcat
14 [ stage0 ? packagesStage0
15 , stage1 ? packagesStage1 ]
16
17 packagesStage0 :: Packages
18 packagesStage0 = mconcat
19 [ append [ binPackageDb, binary, cabal, compiler, hoopl, hpc, transformers ]
20 , notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
21
22 -- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
23 packagesStage1 :: Packages
24 packagesStage1 = mconcat
25 [ packagesStage0
26 , append [ array, base, bytestring, containers, deepseq, directory
27 , filepath, ghcPrim, haskeline, integerLibrary, pretty, process
28 , templateHaskell, time ]
29 , windowsHost ? append [win32]
30 , notM windowsHost ? append [unix]
31 , buildHaddock ? append [xhtml] ]
32
33 knownPackages :: [Package]
34 knownPackages = defaultKnownPackages ++ userKnownPackages
35
36 -- Note: this is slow but we keep it simple as there not too many packages (30)
37 findKnownPackage :: PackageName -> Maybe Package
38 findKnownPackage name = find (\pkg -> pkgName pkg == name) knownPackages