I found the concept of these semantic hashes interesting. I was wondering how the normalization ensures that these are always the same, even if I change the order of elements within the dhall file.
I wanted to use semantic hashes in a project of mine where I manipulate data. It would be a nice feature to ensure that refactoring my DSL keeps the semantics the same.
My DSL can be used to do calculations on data. Let’s say I read a CSV and average column col1
. This gives hash A. But if I rename column col1
to col2
and then average col2
, the same hash should be generated.
Or, given that every row in a dataset has the same number of entries, then the average of each row summed is the same as the sum of each row and then that number is averaged.
Edit: I just noticed something else. Even if Dhall creates some object with certain keys, the binary serialization needs to serialize each field in the same order, always, to ensure that the same hash is generated. Is that assumption true?