You may want to look at this GHCi session:
Prelude> data Unit = Unit deriving Show
Prelude> let x = Unit
Prelude> let x2 = Unit
Prelude> :p x
x = (_t1::Unit)
Prelude> x2
Unit
Prelude> :p x
x = <.:Interactive.Unit>
Prelude> let x3 = Unit
Prelude> :p x3
x3 = <.:Interactive.Unit>
Basically, after x
and x2
are defined, x
is an unevaluated thunk. After I force the evaluation of x2
, we discover that x
was evaluated as well. Variable x3
, despite being defined later, is never in an unevaluated state.
I believe that GHCi is playing some optimization here, creating just a single thunk for Unit
. Every time you use the value constructor Unit
, GHCi re-uses that thunk. Hence, the first time the single thunk is forced, every variable defined through the constructor appears in an evaluated state.
IIRC, small Integer
literals use a shared pre-evaluated thunk as well:
Prelude> let y3 = 3 :: Integer
Prelude> :p y3
y3 = 3
Prelude> let y4 = 344444444444444 :: Integer
Prelude> :p y4
y4 = (_t3::Integer)