Skip to content

generic cas-hashable contentHash result change if you move your type to another module / package #202

@guibou

Description

@guibou

Describe the bug

The result of for contentHash depends on the name of module and package where the type is defined, see for example the instance for [a]:

https://github.com/tweag/funflow/blob/master/cas/hashable/src/Data/CAS/ContentHashable.hs#L385

It depends on contentHashUpdate_fingerprint which takes the module name and package name into account.

It leads to a change of hash if you move your type to another module / package.

This is super surprising.

To Reproduce

Create a type such as:

data MyType = MyType Int
   deriving (ContentHashable m, Generic)

and call contentHash ([MyType 5])

Move it to different module or different package and see the different hash.

Expected behavior

Either it should be documented it should not depend on the package or module name.

Additional context

Note that running the compiled code or running the code from GHCi will also change the hash, because in GHCi, package name is 'main', when it is different in a compiled code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions