Describes a dependency on a source package (API)
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.
Constructors
Dependency PackageName VersionRange (NonEmptySet LibraryName)The set of libraries required from the package. Only the selected libraries will be built. It does not affect the cabal-install solver yet.
Instances12Eq, Data, Ord, Read, Show, Generic, …
Eq DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyData DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyOrd DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyRead DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyShow DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyGeneric DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyNFData DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyBinary DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyParsec DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyExample1 expression simpleParsec "mylib:sub" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))
Example1 expression simpleParsec "mylib:{sub1,sub2}" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
Example1 expression simpleParsec "mylib:{ sub1 , sub2 }" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
Example1 expression simpleParsec "mylib:{ sub1 , sub2 } ^>= 42" :: Maybe DependencyJust (Dependency (PackageName "mylib") (MajorBoundVersion (mkVersion [42])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
Example1 expression simpleParsec "mylib:{ } ^>= 42" :: Maybe DependencyNothing
Example1 expression traverse_ print (map simpleParsec ["mylib:mylib", "mylib:{mylib}", "mylib:{mylib,sublib}" ] :: [Maybe Dependency])Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [])))Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [])))Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [LSubLibName (UnqualComponentName "sublib")])))
Spaces around colon are not allowed:
Example1 expression map simpleParsec ["mylib: sub", "mylib :sub", "mylib: {sub1,sub2}", "mylib :{sub1,sub2}"] :: [Maybe Dependency][Nothing,Nothing,Nothing,Nothing]
Sublibrary syntax is accepted since
cabal-version: 3.0Example1 expression map (`simpleParsec'` "mylib:sub") [CabalSpecV2_4, CabalSpecV3_0] :: [Maybe Dependency][Nothing,Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))]
Pretty DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.DependencyExample1 expression prettyShow $ Dependency (mkPackageName "pkg") anyVersion mainLibSet"pkg"
Example1 expression prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet"pkg:{pkg, sublib}"
Example1 expression prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib")"pkg:sublib"
Example1 expression prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a")"pkg:{sublib-a, sublib-b}"
Structured DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependencytype Rep Dependency = D1 ('MetaDataDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency"Dependency"
"Distribution.Types.Dependency"
"Cabal-syntax-3.12.1.0-3adc"
'False) (C1 ('MetaCons"Dependency"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmptySet LibraryName)))))