TypeInType fails to compile old code
{-# LANGUAGE TypeInType #-}
module PP where
newtype Field l v = Field { value :: v }
label :: Field l v -> l
label = undefined
class HEq x
hEq :: HEq x => x -> Int
hEq = undefined
class HListGet r where
hListGet :: r -> Int
instance
HEq l => HListGet (Field l v) where
hListGet f = hEq (label f)
fails with
mini.hs:18:29: error:
• Couldn't match type ‘k’ with ‘*’
‘k’ is a rigid type variable bound by
the instance declaration at mini.hs:17:5-33
Expected type: Field * l v
Actual type: Field k l v
• In the first argument of ‘label’, namely ‘f’
In the first argument of ‘hEq’, namely ‘(label f)’
In the expression: hEq (label f)
• Relevant bindings include
f :: Field k l v (bound at mini.hs:18:14)
hListGet :: Field k l v -> Int (bound at mini.hs:18:5)
|
18 | hListGet f = hEq (label f)
|
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |