Skip to content

Open Type Family Kind Resolution

The following is a minimal example of this problem:

-- Section 1
data Animal = Dog | Cat | Mouse
data Planet = Earth | Jupiter | Mars | Saturn
type family ToRes (k :: Type) = (j :: Type)
type instance ToRes Planet = Animal

-- Section 2
type family Thing k (a :: k) = (b :: ToRes k)
type instance Thing Planet 'Earth = 'Dog

The last line fails with:

Expected kind 'ToRes Planet', but 'Dog has kind Animal

What's weird is that, if I take the part labeled Section 1 and move it into another module and then import that module into one that contains Section 2, it compiles fine. In this minimal case, that's not a huge problem, but for my real use case, splitting the type instances into two modules like this forces me to use an orphan.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information