Skip to content

cabal check: add typed errors #8269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Compiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ defaultCompilerFlavor = case buildCompilerFlavor of
-- Cabal parses only @ghc-options@ and @ghcjs-options@, others are omitted.
--
data PerCompilerFlavor v = PerCompilerFlavor v v
deriving (Generic, Show, Read, Eq, Typeable, Data, Functor, Foldable
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data, Functor, Foldable
, Traversable)

instance Binary a => Binary (PerCompilerFlavor a)
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/License.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ data License =

-- | Indicates an erroneous license name.
| UnknownLicense String
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

instance Binary License
instance Structured License
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Parsec/Warning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ instance NFData PWarnType where rnf = genericRnf

-- | Parser warning.
data PWarning = PWarning !PWarnType !Position String
deriving (Show, Generic)
deriving (Eq, Ord, Show, Generic)

instance Binary PWarning
instance NFData PWarning where rnf = genericRnf
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/Benchmark.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data Benchmark = Benchmark {
benchmarkInterface :: BenchmarkInterface,
benchmarkBuildInfo :: BuildInfo
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary Benchmark
instance Structured Benchmark
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/BenchmarkInterface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data BenchmarkInterface =
-- interfaces for the given reason (e.g. unknown benchmark type).
--
| BenchmarkUnsupported BenchmarkType
deriving (Eq, Generic, Read, Show, Typeable, Data)
deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)

instance Binary BenchmarkInterface
instance Structured BenchmarkInterface
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/BenchmarkType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data BenchmarkType = BenchmarkTypeExe Version
-- ^ \"type: exitcode-stdio-x.y\"
| BenchmarkTypeUnknown String Version
-- ^ Some unknown benchmark type e.g. \"type: foo\"
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary BenchmarkType
instance Structured BenchmarkType
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/BuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ data BuildInfo = BuildInfo {
targetBuildDepends :: [Dependency], -- ^ Dependencies specific to a library or executable target
mixins :: [Mixin]
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary BuildInfo
instance Structured BuildInfo
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/BuildType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data BuildType
-- information used by later phases.
| Make -- ^ calls @Distribution.Make.defaultMain@
| Custom -- ^ uses user-supplied @Setup.hs@ or @Setup.lhs@ (default)
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary BuildType
instance Structured BuildType
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ data Dependency = Dependency
-- ^ The set of libraries required from the package.
-- Only the selected libraries will be built.
-- It does not affect the cabal-install solver yet.
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

depPkgName :: Dependency -> PackageName
depPkgName (Dependency pn _ _) = pn
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ExeDependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data ExeDependency = ExeDependency
PackageName
UnqualComponentName -- name of executable component of package
VersionRange
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

instance Binary ExeDependency
instance Structured ExeDependency
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/Executable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data Executable = Executable {
exeScope :: ExecutableScope,
buildInfo :: BuildInfo
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance L.HasBuildInfo Executable where
buildInfo f l = (\x -> l { buildInfo = x }) <$> f (buildInfo l)
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ExecutableScope.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import qualified Text.PrettyPrint as Disp

data ExecutableScope = ExecutablePublic
| ExecutablePrivate
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Pretty ExecutableScope where
pretty ExecutablePublic = Disp.text "public"
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ForeignLib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data ForeignLib = ForeignLib {
-- the condition trees (for instance, when creating an sdist)
, foreignLibModDefFile :: [FilePath]
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

data LibVersionInfo = LibVersionInfo Int Int Int deriving (Data, Eq, Generic, Typeable)

Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ForeignLibOption.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data ForeignLibOption =
-- This option is compulsory on Windows and unsupported
-- on other platforms.
ForeignLibStandalone
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Pretty ForeignLibOption where
pretty ForeignLibStandalone = Disp.text "standalone"
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ForeignLibType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data ForeignLibType =
| ForeignLibNativeStatic
-- TODO: Maybe this should record a string?
| ForeignLibTypeUnknown
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Pretty ForeignLibType where
pretty ForeignLibNativeShared = Disp.text "native-shared"
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import qualified Text.PrettyPrint as Disp
data LegacyExeDependency = LegacyExeDependency
String
VersionRange
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

instance Binary LegacyExeDependency
instance Structured LegacyExeDependency
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/Library.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data Library = Library
, libVisibility :: LibraryVisibility -- ^ Whether this multilib can be dependent from outside.
, libBuildInfo :: BuildInfo
}
deriving (Generic, Show, Eq, Read, Typeable, Data)
deriving (Generic, Show, Eq, Ord, Read, Typeable, Data)

instance L.HasBuildInfo Library where
buildInfo f l = (\x -> l { libBuildInfo = x }) <$> f (libBuildInfo l)
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/LibraryVisibility.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data LibraryVisibility
= LibraryVisibilityPublic
-- | Internal library, default
| LibraryVisibilityPrivate
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Pretty LibraryVisibility where
pretty LibraryVisibilityPublic = Disp.text "public"
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/ModuleReexport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data ModuleReexport = ModuleReexport {
moduleReexportOriginalName :: ModuleName,
moduleReexportName :: ModuleName
}
deriving (Eq, Generic, Read, Show, Typeable, Data)
deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)

instance Binary ModuleReexport
instance Structured ModuleReexport
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/PackageDescription.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ data PackageDescription
extraTmpFiles :: [FilePath],
extraDocFiles :: [FilePath]
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add a number of Ord instances after structuring check errors (before: sorting was done on output Strings). It seems to me the new deriving (Ord) will not cause problems (most of the types are sum types).


instance Binary PackageDescription
instance Structured PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/PkgconfigDependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import qualified Distribution.Compat.CharParsing as P
data PkgconfigDependency = PkgconfigDependency
PkgconfigName
PkgconfigVersionRange
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

instance Binary PkgconfigDependency
instance Structured PkgconfigDependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ data PkgconfigVersionRange
| PcOrEarlierVersion PkgconfigVersion -- =< version
| PcUnionVersionRanges PkgconfigVersionRange PkgconfigVersionRange
| PcIntersectVersionRanges PkgconfigVersionRange PkgconfigVersionRange
deriving (Generic, Read, Show, Eq, Typeable, Data)
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)

instance Binary PkgconfigVersionRange
instance Structured PkgconfigVersionRange
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/SetupBuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data SetupBuildInfo = SetupBuildInfo
-- internally, and doesn't correspond to anything in the .cabal
-- file. See #3199.
}
deriving (Generic, Show, Eq, Read, Typeable, Data)
deriving (Generic, Show, Eq, Ord, Read, Typeable, Data)

instance Binary SetupBuildInfo
instance Structured SetupBuildInfo
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/TestSuite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data TestSuite = TestSuite {
testBuildInfo :: BuildInfo,
testCodeGenerators :: [String]
}
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance L.HasBuildInfo TestSuite where
buildInfo f l = (\x -> l { testBuildInfo = x }) <$> f (testBuildInfo l)
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/TestSuiteInterface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ data TestSuiteInterface =
-- the given reason (e.g. unknown test type).
--
| TestSuiteUnsupported TestType
deriving (Eq, Generic, Read, Show, Typeable, Data)
deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)

instance Binary TestSuiteInterface
instance Structured TestSuiteInterface
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/TestType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Text.PrettyPrint (char, text)
data TestType = TestTypeExe Version -- ^ \"type: exitcode-stdio-x.y\"
| TestTypeLib Version -- ^ \"type: detailed-x.y\"
| TestTypeUnknown String Version -- ^ Some unknown test type e.g. \"type: foo\"
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary TestType
instance Structured TestType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data VersionRange
| MajorBoundVersion Version -- @^>= ver@ (same as >= ver && < MAJ(ver)+1)
| UnionVersionRanges VersionRange VersionRange
| IntersectVersionRanges VersionRange VersionRange
deriving ( Data, Eq, Generic, Read, Show, Typeable )
deriving ( Data, Eq, Ord, Generic, Read, Show, Typeable )

instance Binary VersionRange
instance Structured VersionRange
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Language/Haskell/Extension.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ data Language =

-- | An unknown language, identified by its name.
| UnknownLanguage String
deriving (Generic, Show, Read, Eq, Typeable, Data)
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)

instance Binary Language
instance Structured Language
Expand Down
Loading