[GHC] #1795: typechecker loops on simple program with fundep

GHC trac at galois.com
Mon Oct 22 11:05:32 EDT 2007


#1795: typechecker loops on simple program with fundep
-----------------------+----------------------------------------------------
  Reporter:  guest     |          Owner:          
      Type:  bug       |         Status:  new     
  Priority:  normal    |      Milestone:          
 Component:  Compiler  |        Version:  6.8     
  Severity:  major     |       Keywords:          
Difficulty:  Unknown   |             Os:  Multiple
  Testcase:  yes       |   Architecture:  x86     
-----------------------+----------------------------------------------------
 The program below causes the "Renamer/typechecker" phase to loop.
 Confirmed with GHC 6.8.20070927 on Linux and 6.9.20071018 on Windows (so
 I'm not absolutely certain it's present in latest 6.8, but it seems very
 likely).

 The program has an infinite type - the definition of translate causes
 (String, a) to be unified with a. Removing the fundep in MkA causes a
 reasonable error to be reported.

 {{{
 {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
 FlexibleInstances #-}
 module X() where

 data A a = A

 class MkA a b | a -> b where
    mkA :: a -> A b

 instance MkA a a where

 translate :: (String, a) -> A a
 translate a = mkA a
 }}}

 Ganesh

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1795>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list