15
votes
1answer
790 views

Why does this simple use of the State monad cause a stack overflow?

I was playing around with the State monad, and I don't know what's causing the stack overflow in this simple piece of code. import Control.Monad.State.Lazy tick :: State Int Int tick = do n <- ...
5
votes
3answers
749 views

How to avoid stack space overflows?

I've been a bit surprised by GHC throwing stack overflows if I'd need to get value of large list containing memory intensive elements. I did expected GHC has TCO so I'll never meet such situations. ...
5
votes
4answers
373 views

Recovering from stack overflow or heap exhaustion in a Haskell program

I am currently writting a genetic algorithm in Haskell in which my chromosomes are rather complex structures representing executable systems. In order for me to evaluate the fitness of my chromosomes ...
8
votes
1answer
318 views

How to avoid stack overflow in Haskell?

Haskell does not support cycling for computation, instead it offers to use recursion algorithms. But this approach leads to growing of stack, and even stack overflow. I believe there should be ...
3
votes
2answers
273 views

Haskell foldl and stack overflow?

I read a posting claims foldl may occur stack overflow easily. And the posting sample code was: maximum [1..1000000] The code doesn't overflown in my machine. However it can vary by environment. I ...
3
votes
3answers
258 views

Why does this Show instance in Haskell (Hugs) cause a stack overflow error?

The following is a polymorphic data type in Haskell, interpreted by Hugs. I am trying to create an instance of Show for Equality. The instance declaration says that if a type "a" is in Show, then ...
0
votes
2answers
222 views

Problem with Fibonacci Haskell Implementation

Just started re-learning Haskell (did it at uni but forgot most of it) and thought I would implement a Fibonacci function to start of with. However, I keep getting a stackoverflow, even for very small ...