sleep fails for compiled program
For the following program, runghc or ghci produces a list of numbers with a delay between printing each number. But when I run the compiled program, there is no delay.
import System.Posix
main = loop 10
loop 0 = print "done"
loop n = do
print n
sleep 3
loop $ n - 1