3 ms·
> and because Haskell is lazy, `let a = a` is a nonterminating computation I am pretty sure that lazyness has nothing to do with this.
by AnaniasAnanas 8y ago
> and because Haskell is lazy, `let a = a` is a nonterminating computation
I am pretty sure that lazyness has nothing to do with this.
- TheAsprngHacker 8y agoMaybe I worded that wrong. In OCaml and other strict languages, `let (rec) a = a` doesn't make sense, because `a` doesn't have a value when you are defining it to be itself. When I write `let a = a` in Haskell, what happens is that `a` is set to a thunk whose code pointer points to its own evaluation code. When the thunk gets forced, it tries to evaluate itself. Doing my research, I was wrong about the "nonterminating computation" part; when the thunk gets forced, it gets marked as a "black hole," detecting the infinite recursion in this case.