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
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to