executableMatchesCabal :: String -> Version -> GenericPackageDescription -> Bool
executableMatchesCabal executable cabalVersion pkgDescr =
    case lookup executable $ condExecutables pkgDescr of
      Nothing -> False
      Just depGraph ->
          let deps = condTreeConstraints depGraph
              isCabalDep (Dependency (PackageName name) _) = name == "Cabal"
              cabalDeps = filter isCabalDep deps
              matchesDep (Dependency _ versionRange) = cabalVersion `withinRange` versionRange
          in all matchesDep cabalDeps
executableMatchesCabal :: String -> Version -> GenericPackageDescription -> Bool
executableMatchesCabal executable cabalVersion pkgDescr =
    case lookup executable $ condExecutables pkgDescr of
      Nothing -> False
      Just depGraph ->
          let deps = condTreeConstraints depGraph
              isCabalDep (Dependency (PackageName name) _) = name == "Cabal"
              cabalDeps = filter isCabalDep deps
              matchesDep (Dependency _ versionRange) = cabalVersion `withinRange` versionRange
          in all matchesDep cabalDeps
executableMatchesCabal executable cabalVersion pkgDescr =
    case lookup executable $ condExecutables pkgDescr of
      Nothing -> False
      Just depGraph ->
          let deps = condTreeConstraints depGraph
              isCabalDep (Dependency (PackageName name) _) = name == "Cabal"
              cabalDeps = filter isCabalDep deps
              matchesDep (Dependency _ versionRange) = cabalVersion `withinRange` versionRange
          in all matchesDep cabalDeps