on 5bd95c8 help sign in
stackage/Stackage/Types.hs
82 lines 3.0 kB history raw
1module Stackage.Types
2 ( module X
3 , module Stackage.Types
4 ) where
6import Data.Map as X (Map)
7import Data.Map (unionWith)
8import Data.Monoid (Monoid (..))
9import Data.Set as X (Set)
10import Data.Version as X (Version)
11import Distribution.Package as X (PackageIdentifier (..),
12 PackageName (..))
13import Distribution.Version as X (VersionRange (..))
15newtype PackageDB = PackageDB (Map PackageName PackageInfo)
16 deriving (Show, Eq)
18instance Monoid PackageDB where
19 mempty = PackageDB mempty
20 PackageDB x `mappend` PackageDB y =
21 PackageDB $ unionWith newest x y
22 where
23 newest pi1 pi2
24 | piVersion pi1 > piVersion pi2 = pi1
25 | otherwise = pi2
27data PackageInfo = PackageInfo
28 { piVersion :: Version
29 , piDeps :: Map PackageName VersionRange
30 , piHasTests :: Bool
31 , piBuildTools :: Set PackageName
32 }
33 deriving (Show, Eq)
35-- | Information on a package we're going to build.
36data BuildInfo = BuildInfo
37 { biVersion :: Version
38 , biUsers :: [PackageName]
39 , biMaintainer :: Maintainer
40 , biDeps :: Map PackageName VersionRange
41 }
43data HaskellPlatform = HaskellPlatform
44 { hpcore :: Set PackageIdentifier
45 , hplibs :: Set PackageIdentifier
46 }
47 deriving (Show, Eq, Ord)
48instance Monoid HaskellPlatform where
49 mempty = HaskellPlatform mempty mempty
50 HaskellPlatform a x `mappend` HaskellPlatform b y = HaskellPlatform (mappend a b) (mappend x y)
52data InstallInfo = InstallInfo
53 { iiCore :: Set PackageName
54 , iiPackages :: Map PackageName (Version, Maintainer)
55 , iiOptionalCore :: Map PackageName Version
56 -- ^ This is intended to hold onto packages which might be automatically
57 -- provided in the global package database. In practice, this would be
58 -- Haskell Platform packages provided by distributions.
59 , iiPackageDB :: PackageDB
60 }
62-- | Email address of a Stackage maintainer.
63newtype Maintainer = Maintainer { unMaintainer :: String }
64 deriving (Show, Eq, Ord)
66data BuildSettings = BuildSettings
67 { sandboxRoot :: FilePath
68 , extraBuildArgs :: [String]
69 , extraCore :: Set PackageName
70 , expectedFailures :: Set PackageName
71 , stablePackages :: Map PackageName (VersionRange, Maintainer)
72 , extraArgs :: [String]
73 , haskellPlatformCabal :: FilePath
74 , requireHaskellPlatform :: Bool
75 , cleanBeforeBuild :: Bool
76 , excludedPackages :: Set PackageName
77 -- ^ Packages which should be dropped from the list of stable packages,
78 -- even if present via the Haskell Platform or @stablePackages@. If these
79 -- packages are dependencies of others, they will still be included.
80 , testWorkerThreads :: Int
81 -- ^ How many threads to spawn for running test suites.
82 }