[Haskell-cafe] an evil type hangs GHC

Petr Pudlak deb at pudlak.name
Fri Nov 12 13:52:53 EST 2010


Hi, I was playing with the following example I found in D.A.Turner's 
paper Total Functional Programming:

> data Bad a = C (Bad a -> a)
> 
> bad1 :: Bad a -> a
> bad1 b@(C f) = f b
> 
> bad2 :: a
> bad2 = bad1 (C bad1)

To my surprise, instead of creating a bottom valued function (an 
infinite loop), I managed to send the GHC compiler (ver. 6.12.1) to an 
infinite loop. Could anybody suggest an explanation? Is this a GHC bug? 
Or is this "Bad" data type so evil that type checking fails?

     Thanks,
     Petr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20101112/9a1e7e37/attachment.bin


More information about the Haskell-Cafe mailing list