Skip to content

Commit 14e059c

Browse files
author
Bartosz Nitka
committed
Update to Cabal-1.24, aeson-0.11.0.0
1 parent ac01fb1 commit 14e059c

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changes
22
=======
33

4+
Version 0.4
5+
-----------
6+
7+
Update to Cabal-1.24.
8+
Update to aeson-0.11.0.0.
9+
410
Version 0.3
511
-----------
612

haskell-packages.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- documentation, see http://haskell.org/cabal/users-guide/
33

44
name: haskell-packages
5-
version: 0.3
5+
version: 0.4
66
synopsis: Haskell suite library for package management and integration with Cabal
77
description: See <http://documentup.com/haskell-suite/haskell-packages>
88
license: MIT
@@ -39,9 +39,9 @@ library
3939
build-depends:
4040
base >=4.5 && < 5
4141
, optparse-applicative >= 0.11
42-
, aeson >= 0.6
42+
, aeson >= 0.11
4343
, bytestring >= 0.9
44-
, Cabal == 1.22.*
44+
, Cabal == 1.24.*
4545
, deepseq
4646
, directory
4747
, filepath

src/Distribution/HaskellSuite/Cabal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ customMain additionalActions t =
153153
cppOptsParser <*>
154154
(option (simpleParseM "package name") (long "package-name" <> metavar "NAME-VERSION")) <*>
155155
pkgDbStackParser <*>
156-
(many $ InstalledPackageId <$> strOption (long "package-id")) <*>
156+
(many $ mkUnitId <$> strOption (long "package-id")) <*>
157157
(many $ argument str (metavar "MODULE"))
158158

159159
data ModuleNotFound = ModuleNotFound String

src/Distribution/HaskellSuite/Compiler.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type CompileFn
4747
-> CpphsOptions -- ^ CPP options
4848
-> PackageId -- ^ name and version of the package being compiled
4949
-> PackageDBStack -- ^ package db stack to use
50-
-> [InstalledPackageId] -- ^ dependencies
50+
-> [UnitId] -- ^ dependencies
5151
-> [FilePath] -- ^ list of files to compile
5252
-> IO ()
5353

@@ -113,7 +113,7 @@ class IsPackageDB (DB compiler) => Is compiler where
113113
Nothing -> throwIO RegisterNullDB
114114
Just db -> do
115115
pkgs <- readPackageDB (maybeInitDB dbspec) db
116-
let pkgid = installedPackageId pkg
116+
let pkgid = installedUnitId pkg
117117
writePackageDB db $ pkg : removePackage pkgid pkgs
118118

119119
-- | Unregister the package
@@ -149,7 +149,7 @@ class IsPackageDB (DB compiler) => Is compiler where
149149
else do
150150
putStrLn "Packages removed:"
151151
forM_ packagesRemoved $ \p ->
152-
putStrLn $ " " ++ display (installedPackageId p)
152+
putStrLn $ " " ++ display (installedUnitId p)
153153

154154
writePackageDB db packagesLeft
155155

@@ -165,10 +165,10 @@ class IsPackageDB (DB compiler) => Is compiler where
165165
Just db -> do
166166
pkgs <- readPackageDB (maybeInitDB dbspec) db
167167

168-
forM_ pkgs $ putStrLn . display . installedPackageId
168+
forM_ pkgs $ putStrLn . display . installedUnitId
169169

170-
removePackage :: InstalledPackageId -> Packages -> Packages
171-
removePackage pkgid = filter ((pkgid /=) . installedPackageId)
170+
removePackage :: UnitId -> Packages -> Packages
171+
removePackage pkgid = filter ((pkgid /=) . installedUnitId)
172172

173173
data Simple db = Simple
174174
{ stName :: String

src/Distribution/HaskellSuite/Packages.hs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ import System.FilePath
7676
import System.Directory
7777

7878
-- The following imports are needed only for JSON instances
79-
import Data.Version (Version(..))
8079
import Distribution.Simple.Compiler (PackageDB(..))
8180
import Distribution.License (License(..))
8281
import Distribution.ModuleName(ModuleName)
@@ -107,21 +106,21 @@ getInstalledPackages _proxy dbspec = do
107106
(mbDb :: Maybe db)
108107

109108
-- | Try to retrieve an 'InstalledPackageInfo' for each of
110-
-- 'InstalledPackageId's from a specified set of 'PackageDB's.
109+
-- 'UnitId's from a specified set of 'PackageDB's.
111110
--
112111
-- May throw a 'PkgInfoNotFound' exception.
113112
--
114113
-- If a database doesn't exist, the behaviour is determined by
115114
-- 'maybeInitDB'.
116115
readPackagesInfo
117116
:: IsPackageDB db
118-
=> Proxy db -> [PackageDB] -> [InstalledPackageId] -> IO Packages
117+
=> Proxy db -> [PackageDB] -> [UnitId] -> IO Packages
119118
readPackagesInfo proxyDb dbs pkgIds = do
120119
allPkgInfos <- concat <$> mapM (getInstalledPackages proxyDb) dbs
121120
let
122121
pkgMap =
123122
Map.fromList
124-
[ (Info.installedPackageId pkgInfo, pkgInfo)
123+
[ (Info.installedUnitId pkgInfo, pkgInfo)
125124
| pkgInfo <- allPkgInfos
126125
]
127126
forM pkgIds $ \pkgId ->
@@ -290,7 +289,7 @@ errPrefix = "haskell-suite package manager"
290289
data PkgDBError
291290
= BadPkgDB FilePath -- ^ package database could not be parsed or contains errors
292291
| PkgDBReadError FilePath IOException -- ^ package db file could not be read
293-
| PkgExists InstalledPackageId -- ^ attempt to register an already present package id
292+
| PkgExists UnitId -- ^ attempt to register an already present package id
294293
| RegisterNullDB -- ^ attempt to register in the global db when it's not present
295294
deriving (Typeable)
296295
instance Show PkgDBError where
@@ -306,7 +305,7 @@ instance Show PkgDBError where
306305
instance Exception PkgDBError
307306

308307
data PkgInfoError
309-
= PkgInfoNotFound InstalledPackageId
308+
= PkgInfoNotFound UnitId
310309
-- ^ requested package id could not be found in any of the package databases
311310
deriving Typeable
312311
instance Exception PkgInfoError
@@ -328,11 +327,6 @@ instance ToJSON License where
328327
instance FromJSON License where
329328
parseJSON = stdFromJSON
330329

331-
instance ToJSON Version where
332-
toJSON = stdToJSON
333-
instance FromJSON Version where
334-
parseJSON = stdFromJSON
335-
336330
instance ToJSON ModuleName where
337331
toJSON = stdToJSON
338332
instance FromJSON ModuleName where
@@ -348,16 +342,16 @@ instance ToJSON PackageIdentifier where
348342
instance FromJSON PackageIdentifier where
349343
parseJSON = stdFromJSON
350344

351-
instance ToJSON InstalledPackageId where
345+
instance ToJSON UnitId where
352346
toJSON = stdToJSON
353-
instance FromJSON InstalledPackageId where
347+
instance FromJSON UnitId where
354348
parseJSON = stdFromJSON
355349

356-
instance ToJSON PackageKey where
350+
instance ToJSON AbiHash where
357351
toJSON = stdToJSON
358-
instance FromJSON PackageKey where
352+
instance FromJSON AbiHash where
359353
parseJSON = stdFromJSON
360354

361355
deriveJSON defaultOptions ''Info.OriginalModule
362356
deriveJSON defaultOptions ''Info.ExposedModule
363-
deriveJSON defaultOptions ''Info.InstalledPackageInfo_
357+
deriveJSON defaultOptions ''Info.InstalledPackageInfo

0 commit comments

Comments
 (0)