Skip to content

typechecker loops on simple program with fundep

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

PS: See also #1797 (closed) and #1781 (closed)

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information