Changes between Initial Version and Version 1 of Ticket #7411, comment 22


Ignore:
Timestamp:
May 8, 2018 3:25:51 PM (17 months ago)
Author:
tdammers
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7411, comment 22

    initial v1  
    1717This is essentially what `deepseq` does on lists, with all the typeclass instances and type variables manually unrolled.
    1818
     19Compiling this without optimizations (`-O0`) produces a program that throws an exception at runtime, as it should. Compiling with `-O`, however, the resulting program finishes without error.
     20
    1921Note that in order to trigger the bug, we actually do need the `go` function; if instead we pass the `b` around and recurse directly, the problem goes away, like so:
    2022
     
    2325
    2426dslist :: [a] -> b -> b
    25 dslist xs b = go xs `seq` b
    26   where
    27     dslist [] a = a
    28     dslist (x:xs) a = x `seq` dslist xs a
     27dslist [] b = b
     28dslist (x:xs) b = x `seq` dslist xs b
    2929
    3030main = evaluate (('a':undefined) `dslist` return () :: IO ())