Edit: very small repro available https://github.com/dten/CouldntMatchTypeRepro
stack test worked fine on stack LTS-8.24 (ghc 8.0.2) and i tried to change to LTS-10.5 (ghc 8.2.2). It now fails type checking and the error message is less than helpful.
The MyId types listed literally are the same type, declared in my-model makeId is in a testing-help package that references my-model and this code is in a test package that references both.
Moving the function to the my-model package results in no error (but I don't want to, and I have the problem with other types even in the same package (always a usage in the test package)) I have read through migration info to 8.2 but nothing stood out. Any pointer in the correct direction is appreciated :) thanks
test\Spec.hs:785:11: error:
* Couldn't match type `my-model-0.0.0:Types.Ids.MyId'
with `MyId'
NB: `MyId'
is defined in `Types.Ids' in package `my-model-0.0.0'
`my-model-0.0.0:Types.Ids.MyId'
is defined in `Types.Ids' in package `my-model-0.0.0'
Expected type: UserId
Actual type: my-model-0.0.0:Types.Ids.MyId
* In the expression: makeId "19186adb-26e5-4901-956c-f3ba11fc016d"
In an equation for `userId':
userId = makeId "19186adb-26e5-4901-956c-f3ba11fc016d"
|
785 | userId = makeId "19186adb-26e5-4901-956c-f3ba11fc016d"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
edits: I have tried deleting .stack-work and even ~/stack-root
the packages layout is as follows:
package: my-model
library
test-suite test
deps: my-model, testing-help
package: testing-help
library
deps: my-model
no version requirements are set (because it's stack LTS style) and all versions of my packages are 0.0.0
edit2: they're all in 1 stack.yaml
edit3: sorry got package deps wrong
my-model-0.0.0and the other is one you apparently have defined locally? - Willem Van Onsemmy-model. - Carlmy-model-0.0.0, I'm betting you made changes to the package without updating the version, recompiled it, and didn't recompile everything that depended on it. This is a dangerous workflow. (ghc distinguishes packages by a package-id hash internally, so it can tell the packages apart. It only displays version numbers, so you can't tell them apart. This is a problem.) - Carl