debugging - Finding where <<loop>> happened -


if <<loop>>, means haskell had managed detect infinite loop. there way ghc tell loop happened? seems haskell should have information somewhere.

compile app -prof , -fprof-auto(if you're using cabal, use --enable-executable-profiling , --ghc-options=-fprof-auto) , run +rts -xc. it'll print stack trace when errors happen. should narrow scope.

example:

➜  haskell  cat loop.hs  myfun :: int myfun =     let g = g + 1     in g + 10  main = print myfun ➜  haskell  ghc loop.hs -prof -fprof-auto [1 of 1] compiling main             ( loop.hs, loop.o ) linking loop ... ➜  haskell  ./loop +rts -xc                              *** exception (reporting due +rts -xc): (thunk_static), stack trace:    main.myfun.g,   called main.myfun,   called main.caf *** exception (reporting due +rts -xc): (thunk_static), stack trace:    main.myfun.g,   called main.myfun,   called main.caf loop: <<loop>> 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -