#1900: Type families with class constraints: type-checker loops
------------------------+---------------------------------------------------
 Reporter:  h.holtmann  |          Owner:     
     Type:  bug         |         Status:  new
 Priority:  normal      |      Milestone:     
Component:  Compiler    |        Version:  6.9
 Severity:  normal      |       Keywords:     
 Testcase:              |   Architecture:  x86
       Os:  Linux       |  
------------------------+---------------------------------------------------
 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

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1900>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to