
4 Feb
2007
4 Feb
'07
8:49 a.m.
When I try to compile to the following program, GHC seems to loop: data Evil = Evil (Evil -> Evil) instance Show Evil where show _ = "t" apply :: Evil -> Evil -> Evil apply (Evil f) x = f x delta :: Evil delta = Evil (\x -> x `apply` x) omega :: Evil omega = delta `apply` delta main = print omega The program codes up a non-terminating term omega - very similar to (\x -> x x) (\x -> x x) - without using recursion. The trick is to define an Evil data type which has a negative occurrence of Evil. I realize it's a contrived example, but I wasn't sure if it's a known issue. In case it matters, I'm using GHC 6.6 on a PowerPC Mac. All the best, Wouter