Type family in instance signature confuses GHC
This works:
class F a where
type T a
u :: T a -> a -> a
newtype W a = W a
instance F (W a) where
type T (W a) = T a
u = undefined
instance F () where
type T () = T (W ())
u _ = undefined
Remove one argument to u
and you get
• Reduction stack overflow; size = 201
When simplifying the following type: T (W ())
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the expression: undefined
In an equation for ‘u’: u = undefined
In the instance declaration for ‘F ()’
It is also not accepted to
u :: T (W ()) -> () -> ()
u _ = id @()
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |