4 ms·
they really are the same thing semantically, a thunk is a just closure that will be evaluated once (being applied to a unit/trivial value), and then GHC will ha
by carterschonwald 17y ago
they really are the same thing semantically, a thunk is a just closure that will be evaluated once (being applied to a unit/trivial value), and then GHC will have its runtime mark a bit that indicated that its been evaluated and redirect the thunk pointer to a value. This is simply a difference of efficiency between normal order evaluation vs lazy evaluation, with a special sort of common subexpression elimination built into the language