GHC appears to loop
wss at Cs.Nott.AC.UK
Sun Feb 4 08:49:44 EST 2007
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,
More information about the Glasgow-haskell-users