From fd51f6d4628c466e2871422f0cfae150f072752d Mon Sep 17 00:00:00 2001 From: Josh Leeb-du Toit Date: Thu, 24 Mar 2022 20:32:14 +1100 Subject: [PATCH] Derive Eq on DependencyMap This change derives the `Eq` type class on `DependencyMap` in the `Distribution.Types` module. --- Cabal-syntax/src/Distribution/Types/Dependency.hs | 4 ++++ Cabal-syntax/src/Distribution/Types/DependencyMap.hs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cabal-syntax/src/Distribution/Types/Dependency.hs b/Cabal-syntax/src/Distribution/Types/Dependency.hs index c10910474..321ebc020 100644 --- a/Cabal-syntax/src/Distribution/Types/Dependency.hs +++ b/Cabal-syntax/src/Distribution/Types/Dependency.hs @@ -33,6 +33,10 @@ import qualified Text.PrettyPrint as PP -- /Invariant:/ package name does not appear as 'LSubLibName' in -- set of library names. -- +-- /Note:/ 'Dependency' is not an instance of 'Ord', and so it cannot be used +-- in 'Set' or as the key to a 'Map'. For these and similar use cases see +-- 'DependencyMap'. +-- data Dependency = Dependency PackageName VersionRange diff --git a/Cabal-syntax/src/Distribution/Types/DependencyMap.hs b/Cabal-syntax/src/Distribution/Types/DependencyMap.hs index 823857d8e..c7e66cf73 100644 --- a/Cabal-syntax/src/Distribution/Types/DependencyMap.hs +++ b/Cabal-syntax/src/Distribution/Types/DependencyMap.hs @@ -19,7 +19,7 @@ import qualified Data.Map.Lazy as Map -- | A map of dependencies. Newtyped since the default monoid instance is not -- appropriate. The monoid instance uses 'intersectVersionRanges'. newtype DependencyMap = DependencyMap { unDependencyMap :: Map PackageName (VersionRange, NonEmptySet LibraryName) } - deriving (Show, Read) + deriving (Show, Read, Eq) instance Monoid DependencyMap where mempty = DependencyMap Map.empty -- 2.11.4.GIT