aboutsummaryrefslogtreecommitdiff
path: root/CabalHelper/Licenses.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2016-05-04 20:43:12 +0200
committerDaniel Gröber <dxld@darkboxed.org>2016-05-04 21:55:01 +0200
commitc7eef63e8a33d7811ba9f242b5762dde55366526 (patch)
treed3f4ad52698b990e970b182379a24c8c84dcfdd3 /CabalHelper/Licenses.hs
parent93ea1d6aa14fb7f8a0d42cd167e3a363fc541066 (diff)
Fix Cabal-1.24.0.0
Diffstat (limited to 'CabalHelper/Licenses.hs')
-rw-r--r--CabalHelper/Licenses.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/CabalHelper/Licenses.hs b/CabalHelper/Licenses.hs
index 4660c15..b16f61d 100644
--- a/CabalHelper/Licenses.hs
+++ b/CabalHelper/Licenses.hs
@@ -23,9 +23,12 @@ import Distribution.Simple.Configure
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.PackageIndex
import Distribution.Text
+import Distribution.ModuleName
--------------------------------------------------------------------------------
-#if CABAL_MAJOR == 1 && CABAL_MINOR > 22
+
+
+#if CABAL_MAJOR == 1 && CABAL_MINOR > 22
type CPackageIndex a = PackageIndex (InstalledPackageInfo)
#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 22
type CPackageIndex a = PackageIndex (InstalledPackageInfo_ a)
@@ -35,6 +38,7 @@ type CPackageIndex a = PackageIndex
#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23
type CInstalledPackageId = UnitId
+lookupInstalledPackageId' :: PackageIndex a -> UnitId -> Maybe a
lookupInstalledPackageId' = lookupUnitId
#elif CABAL_MAJOR == 1 && CABAL_MINOR > 22
type CInstalledPackageId = ComponentId
@@ -45,7 +49,7 @@ lookupInstalledPackageId' = lookupInstalledPackageId
#endif
findTransitiveDependencies
- :: CPackageIndex a
+ :: CPackageIndex Distribution.ModuleName.ModuleName
-> Set CInstalledPackageId
-> Set CInstalledPackageId
findTransitiveDependencies pkgIdx set0 = go Set.empty (Set.toList set0)
@@ -86,16 +90,16 @@ groupByLicense
:: [InstalledPackageInfo]
-> [(License, [InstalledPackageInfo])]
groupByLicense = foldl'
- (\assoc ipi -> insert (license ipi) ipi assoc) []
+ (\assoc ipi -> insertAList (license ipi) ipi assoc) []
where
-- 'Cabal.License' doesn't have an 'Ord' instance so we need to use an
-- association list instead of 'Map'. The number of licenses probably won't
-- exceed 100 so I think we're alright.
- insert :: Eq k => k -> v -> [(k, [v])] -> [(k, [v])]
- insert k v [] = [(k, [v])]
- insert k v ((k', vs) : kvs)
+ insertAList :: Eq k => k -> v -> [(k, [v])] -> [(k, [v])]
+ insertAList k v [] = [(k, [v])]
+ insertAList k v ((k', vs) : kvs)
| k == k' = (k, v : vs) : kvs
- | otherwise = (k', vs) : insert k v kvs
+ | otherwise = (k', vs) : insertAList k v kvs
--------------------------------------------------------------------------------