Type families with class constraints: type-checker loops
The following program:
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
class (Eq (Depend s))=> Bug s where
type Depend s
trans :: Depend s -> Depend s
instance Bug Int where
type Depend Int = ()
trans = (+1)
check :: (Bug s) => Depend s -> Bool
check d = d == trans d
runs into a type-checker loop
GHC-Bug.hs:1:0:
Context reduction stack overflow; size = 20
Use -fcontext-stack=N to increase stack size to N
`ic :: {(Bug Int, Eq (Depend Int)) => Num ()}'
arising from the type signature for `trans' at GHC-Bug.hs:24:2-13
`ic :: {(Bug Int, Eq (Depend Int)) => Num ()}'
arising from the type signature for `trans' at GHC-Bug.hs:24:2-13
<snip>
Of course, this program should not compile, but the type-checker should not loop.
compiler: 6.9.20071105
Trac metadata
Trac field | Value |
---|---|
Version | 6.9 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |