localDependencies :: DotOpts -> [LocalPackage] -> [(PackageName,(Set PackageName,Maybe Version))]
localDependencies dotOpts locals =
    map (\lp -> (packageName (lpPackageFinal lp), (deps lp,Just (lpVersion lp)))) locals
  where deps lp = if dotIncludeExternal dotOpts
                then Set.delete (lpName lp) (packageAllDeps (lpPackageFinal lp))
                else Set.intersection localNames (packageAllDeps (lpPackageFinal lp))
        lpName lp = packageName (lpPackageFinal lp)
        localNames = Set.fromList $ map (packageName . lpPackageFinal) locals
        lpVersion lp = packageVersion (lpPackageFinal lp)

-- | Print a graphviz graph of the edges in the Map and highlight the given local packages
localDependencies :: DotOpts -> [LocalPackage] -> [(PackageName,(Set PackageName,Maybe Version))]
localDependencies dotOpts locals =
    map (\lp -> (packageName (lpPackageFinal lp), (deps lp,Just (lpVersion lp)))) locals
  where deps lp = if dotIncludeExternal dotOpts
                then Set.delete (lpName lp) (packageAllDeps (lpPackageFinal lp))
                else Set.intersection localNames (packageAllDeps (lpPackageFinal lp))
        lpName lp = packageName (lpPackageFinal lp)
        localNames = Set.fromList $ map (packageName . lpPackageFinal) locals
        lpVersion lp = packageVersion (lpPackageFinal lp)

-- | Print a graphviz graph of the edges in the Map and highlight the given local packages
localDependencies dotOpts locals =
    map (\lp -> (packageName (lpPackageFinal lp), (deps lp,Just (lpVersion lp)))) locals
  where deps lp = if dotIncludeExternal dotOpts
                then Set.delete (lpName lp) (packageAllDeps (lpPackageFinal lp))
                else Set.intersection localNames (packageAllDeps (lpPackageFinal lp))
        lpName lp = packageName (lpPackageFinal lp)
        localNames = Set.fromList $ map (packageName . lpPackageFinal) locals
        lpVersion lp = packageVersion (lpPackageFinal lp)

-- | Print a graphviz graph of the edges in the Map and highlight the given local packages