Skip to content

Commit

Permalink
Use set for easier to read unique
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann authored and mergify-bot committed Aug 24, 2021
1 parent 0ddb1f6 commit 454139c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions haskell/cabal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1884,12 +1884,14 @@ def _stack_snapshot_impl(repository_ctx):
if name in packages.all or name in vendored_packages:
visibility = ["//visibility:public"]
else:
visibility = sorted({
# use dictionary keys to de-duplicate
str(vendored_packages[rdep].relative(":__pkg__")): None
for rdep in reverse_deps[name]
if rdep in vendored_packages
}.keys())
visibility = sorted(
# use set to de-duplicate
set.to_list(set.from_list([
str(vendored_packages[rdep].relative(":__pkg__"))
for rdep in reverse_deps[name]
if rdep in vendored_packages
])),
)
if not visibility:
visibility = ["//visibility:private"]
visibilities[name] = visibility
Expand Down

0 comments on commit 454139c

Please sign in to comment.