Skip to content

Failure of improvement for type-family dependencies

Consider

{-# LANGUAGE TypeFamilyDependencies #-}

data D x

type family F t = s | s -> t
type instance F (D t) = D (F t)

f :: F s -> ()
f _ = ()

g :: D (F t) -> ()
g x = f x

which was presented in this email from Clinton Mead.

It yields

Tx.hs:14:9: error:
    • Couldn't match expected type ‘F s0’ with actual type ‘D (F t)’
      The type variable ‘s0’ is ambiguous

But it should work fine

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