Ticket #7168: loop.hs

File loop.hs, 354 bytes (added by bas, 20 months ago)

Script for ghci to see the looping behavior

Line 
1f = (1,error "this will not be evaluated!") .++. carefully f
2(a,b) .++. (c,d) = (a+c,0)
3carefully (a,b) = (1, a + b)
4
5-- these definitions are not equivalent, but should be
6-- carefully (a,b) = (0, a + b)
7-- carefully x = (1, fst x + snd x)
8-- run ghci and enter:
9-- *Main> f
10-- this either loops, or is equal to 1, depending on which definition was used