#6123: occurs check should not apply to type families
------------------------------+---------------------------------------------
 Reporter:  dmwit             |          Owner:                         
     Type:  bug               |         Status:  new                    
 Priority:  normal            |      Component:  Compiler (Type checker)
  Version:  7.4.1             |       Keywords:                         
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple       
  Failure:  None/Unknown      |       Testcase:                         
Blockedby:                    |       Blocking:                         
  Related:                    |  
------------------------------+---------------------------------------------
 This code:
 {{{
 {-# LANGUAGE TypeFamilies #-}
 type family Id a
 cid :: a ~ Id a => a -> a
 cid x = x
 cundefined = cid undefined
 }}}
 gives this error:
 {{{
 test.hs:5:14:
     Occurs check: cannot construct the infinite type: a0 = Id a0
     In the expression: cid undefined
     In an equation for `cundefined': cundefined = cid undefined
 }}}
 whereas I think it should be possible to infer the type cundefined :: a ~
 Id a => a. Equations with a variable on one side and a type family at the
 head of the other side should become constraints rather than being subject
 to the occurs check.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6123>
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