Ticket #1900 (closed bug: fixed)
Type families with class constraints: type-checker loops
| Reported by: | h.holtmann | Owned by: | chak |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10 branch |
| Component: | Compiler (Type checker) | Version: | 6.9 |
| Keywords: | Cc: | ||
| Operating System: | Linux | Architecture: | x86 |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | T1900 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

