从哪里开始 "Couldn't match type MyId with MyId"
Where to start with "Couldn't match type MyId with MyId"
编辑:可用的副本非常小 https://github.com/dten/CouldntMatchTypeRepro
stack test
在堆栈 LTS-8.24 (ghc 8.0.2) 上运行良好,我尝试更改为 LTS-10.5 (ghc 8.2.2)。它现在无法通过类型检查并且错误消息没有帮助。
字面上列出的 MyId 类型是同一类型,在 my-model
中声明 makeId
在引用 my-model
的 testing-help
包中,此代码在 test
引用两者的包。
将函数移动到 my-model 包不会导致错误(但我不想,即使在同一个包中我也有其他类型的问题(总是在测试包中使用))
我已经通读了到 8.2 的迁移信息,但没有什么特别之处。
感谢任何指向正确方向的指针:)谢谢
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"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
编辑:我试过删除 .stack-work
甚至 ~/stack-root
包布局如下:
package: my-model
library
test-suite test
deps: my-model, testing-help
package: testing-help
library
deps: my-model
没有设置版本要求(因为它是堆栈 LTS 风格)并且我的包的所有版本都是 0.0.0
edit2:他们都在 1 stack.yaml
edit3: 对不起,包 deps 错了
这似乎是 Cabal 中的一个错误,或者至少是一个缺失的功能。我不知道为什么它适用于较旧的解析器。 Issue 2800 on stack mentions this. See issue 1575, issue 4087 在 Cabal 上。
编辑:可用的副本非常小 https://github.com/dten/CouldntMatchTypeRepro
stack test
在堆栈 LTS-8.24 (ghc 8.0.2) 上运行良好,我尝试更改为 LTS-10.5 (ghc 8.2.2)。它现在无法通过类型检查并且错误消息没有帮助。
字面上列出的 MyId 类型是同一类型,在 my-model
中声明 makeId
在引用 my-model
的 testing-help
包中,此代码在 test
引用两者的包。
将函数移动到 my-model 包不会导致错误(但我不想,即使在同一个包中我也有其他类型的问题(总是在测试包中使用)) 我已经通读了到 8.2 的迁移信息,但没有什么特别之处。 感谢任何指向正确方向的指针:)谢谢
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"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
编辑:我试过删除 .stack-work
甚至 ~/stack-root
包布局如下:
package: my-model
library
test-suite test
deps: my-model, testing-help
package: testing-help
library
deps: my-model
没有设置版本要求(因为它是堆栈 LTS 风格)并且我的包的所有版本都是 0.0.0
edit2:他们都在 1 stack.yaml
edit3: 对不起,包 deps 错了
这似乎是 Cabal 中的一个错误,或者至少是一个缺失的功能。我不知道为什么它适用于较旧的解析器。 Issue 2800 on stack mentions this. See issue 1575, issue 4087 在 Cabal 上。