3 , module Stackage.Types
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 (..),
13import Distribution.Version as X (VersionRange (..))
14import Distribution.Version (intersectVersionRanges)
15import Distribution.PackageDescription (GenericPackageDescription)
17newtype PackageDB = PackageDB (Map PackageName PackageInfo)
20instance Monoid PackageDB where
21 mempty = PackageDB mempty
22 PackageDB x `mappend` PackageDB y =
23 PackageDB $ unionWith newest x y
26 | piVersion pi1 > piVersion pi2 = pi1
29data PackageInfo = PackageInfo
30 { piVersion :: Version
31 , piDeps :: Map PackageName VersionRange
33 , piBuildTools :: Set Executable
34 , piGPD :: Maybe GenericPackageDescription
35 , piExecs :: Set Executable
36 , piGithubUser :: Maybe String
40newtype Executable = Executable String
41 deriving (Show, Eq, Ord)
43-- | Information on a package we're going to build.
44data BuildInfo = BuildInfo
45 { biVersion :: Version
46 , biUsers :: [PackageName]
47 , biMaintainer :: Maintainer
48 , biDeps :: Map PackageName VersionRange
51data HaskellPlatform = HaskellPlatform
52 { hpcore :: Set PackageIdentifier
53 , hplibs :: Set PackageIdentifier
55 deriving (Show, Eq, Ord)
56instance Monoid HaskellPlatform where
57 mempty = HaskellPlatform mempty mempty
58 HaskellPlatform a x `mappend` HaskellPlatform b y = HaskellPlatform (mappend a b) (mappend x y)
60data InstallInfo = InstallInfo
61 { iiCore :: Set PackageName
62 , iiPackages :: Map PackageName (Version, Maintainer)
63 , iiOptionalCore :: Map PackageName Version
64 -- ^ This is intended to hold onto packages which might be automatically
65 -- provided in the global package database. In practice, this would be
66 -- Haskell Platform packages provided by distributions.
67 , iiPackageDB :: PackageDB
70-- | Email address of a Stackage maintainer.
71newtype Maintainer = Maintainer { unMaintainer :: String }
72 deriving (Show, Eq, Ord)
74data BuildSettings = BuildSettings
75 { sandboxRoot :: FilePath
76 , extraBuildArgs :: [String]
77 , extraCore :: Set PackageName
78 , expectedFailures :: Set PackageName
79 , stablePackages :: Map PackageName (VersionRange, Maintainer)
80 , extraArgs :: [String]
81 , haskellPlatformCabal :: FilePath
82 , requireHaskellPlatform :: Bool
83 , cleanBeforeBuild :: Bool
84 , excludedPackages :: Set PackageName
85 -- ^ Packages which should be dropped from the list of stable packages,
86 -- even if present via the Haskell Platform or @stablePackages@. If these
87 -- packages are dependencies of others, they will still be included.
88 , testWorkerThreads :: Int
89 -- ^ How many threads to spawn for running test suites.
91 -- ^ Compile flags which should be turned on.
92 , allowedPackage :: GenericPackageDescription -> Either String ()
93 -- ^ Checks if a package is allowed into the distribution. By default, we
94 -- allow all packages in, though this could be used to filter out certain
95 -- untrusted packages, or packages with an unacceptable license.
97 -- Returns a reason for stripping in Left, or Right if the package is
101-- | A wrapper around a @Map@ providing a better @Monoid@ instance.
102newtype PackageMap = PackageMap { unPackageMap :: Map PackageName (VersionRange, Maintainer) }
104instance Monoid PackageMap where
105 mempty = PackageMap mempty
106 PackageMap x `mappend` PackageMap y =
107 PackageMap $ unionWith go x y
109 go (r1, m1) (r2, _) = (intersectVersionRanges r1 r2, m1)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list