Originated from this question, I have this little F# code (github) to generate random values according to a normal distribution:
// val nextSingle : (unit -&
Looks like a bug in the compiler's sequence expression compilation mechanism. Here's a simplified repro:
let rec loop r = seq {
if r > 0 then
let rec unused() = unused()
yield r
yield! loop r
}
printfn "%i" (Seq.nth 10000000 (loop 1))
Obviously the presence of the unused recursive definition shouldn't affect whether this generates a stack overflow, but it does.