Help: can see why these 2 have 2 different hashes


#1

I can’t see why these two don’t have the same hash :sob::blush:

let k8s =
      https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:d541487f153cee9890ebe4145bae8899e91cd81e2f4a5b65b06dfc325fb1ae7e

let test =
      λ(cfg : k8s.Secret.Type) →
        let metadata =
              cfg.metadata
              with name = Some "Hello"
              with namespace = Some "World"

        in  metadata

in  test

sha256:5e03af415682e22fab175f415411c62c3335b7c47dec390813dc9b30b6436f06

let k8s =
      https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:d541487f153cee9890ebe4145bae8899e91cd81e2f4a5b65b06dfc325fb1ae7e

let test =
      λ(cfg : k8s.Secret.Type) →
        let metadata =
              cfg.metadata ⫽ { name = Some "Hello", namespace = Some "World" }

        in  metadata

in  test

sha256:475954fd1480e035f8ed7d2641fea8e53848147250731b7e35d67b373a9357f5


#2

If you pass the first one through dhall normalize, you can see that it’s equivalent to

let k8s =
      https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:d541487f153cee9890ebe4145bae8899e91cd81e2f4a5b65b06dfc325fb1ae7e

let test =
      λ(cfg : k8s.Secret.Type) →
        let metadata =
              (cfg.metadata ⫽ { name = Some "Hello" }) ⫽ { namespace = Some "World" }

        in  metadata

in  test

which isn’t the same as your second example. I guess we could in theory simplify one to the other but we currently don’t.


#3

Note that I opened a proposal a while ago to add support for reordering associative operations, but it was rejected at the time:

If we supported that then they would be equivalent.