
12 Nov
2010
12 Nov
'10
1:52 p.m.
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