I used to think that span is a function which doesn't run in bounded
space. But ghc defied this understanding. The program copied below
runs in bounded space with "ghc-8.2.1 -O0 main.hs; ./main" but it does
not if run with "runghc-8.2.1 -O0 main.hs".
Does someone have any insights on what's the optimization that is
making a difference in the memory footprint of these two methods of
Or is there a bug in ghci, and span is supposed to run in bounded
space after all?