by bjz_ · 6y ago · 0 comments
Ultimately the failure mode means that you can't build your package and are blocked until a fix is made upstream, where as with a package manager like Cargo you can still build your project. The downside is that you have a duplicate in your dependency graph - but this can be fixed upstream in an asynchronous fashion.
For example, what if my package depends on A(v1.0) and B, B depends on A(v2.0), and furthermore B exposes a type from A(v2.0) in its API? Does the package manager distinguish internal dependencies from dependencies that are exposed in the API of the package?
You sometimes get weird errors like expected `A` but found `A` in the unusual event that you actually run into this, but this is probably something that could be fixed.
Reading that post also reminded me of the Unison language [1] which would even allow the same type from different versions of a library to be identified as the same if it wasn't altered. It does this by identifying every type and function by the hash of their respective definitions.
[1] https://www.haskell.org/cabal/users-guide/nix-local-build.ht...
http_archive(
name = ...,
build_file_content = """
load(
"@org//bazel:defs.bzl",
"pai_haskell_library",
)
pai_haskell_library(
name = ...,
version = ...,
srcs = glob(["src/**/*.hs"]),
stackage_deps = [...],
visibility = ["//visibility:public"]
)
""",
patch_args = ["-p1"],
patches = [
"//dir:git-patch-file",
],
sha256 = "...",
urls = ["https://github.com/org/repo/archive/1.0.0.0.tar.gz"],
)