stack overflow in compiled program but not in ghci