
28 Jun
2017
28 Jun
'17
3:16 p.m.
We had a strange phenomenon while debugging a large compiler. This is the smallest example, but we have seen this behavior in our own monad. module TracEx where import Debug.Trace runit :: IO () runit = traceShow "Bla" $ do traceShow "Bloe” runit and this generates Bla Bloe and then it hangs. Nothing else is generated. We are guessing this has to do with optimisations of some kind. And what about runit :: IO () runit = traceShow "Bla" $ do n <- traceShow "Num" print 2 traceShow "Bloe” runit Now we get Bla Num 2 Bloe 2 Bloe 2 … No more Bla and no more Num. Any ideas whether this is a bug or a feature? Jur and Tibor