Currently we can freely coerce between the Digests of different hash algorithms. This can lead to safety issues, and to prevent it, we should make Digest have a type role Digest nominal
Example issue:
> import Data.Coerce
> x :: Digest SHA256; x = undefined
> y = coerce @(Digest SHA256) @(Digest Blake2b_256) x
> :t y
y :: Digest Blake2b_256
Currently we can freely coerce between the
Digest
s of different hash algorithms. This can lead to safety issues, and to prevent it, we should makeDigest
have atype role Digest nominal
Example issue: