Let T be a type with the default derived Eq instance and x and y elements of type T. If x == y evaluates to True did GHC fully evaluate both types or could GHC have taken some short cut such as comparing if they are the same pointer before comparing structural equality?
Let
T
be a type with the default derivedEq
instance andx
andy
elements of typeT
. Ifx == y
evaluates toTrue
did GHC fully evaluate both types or could GHC have taken some short cut such as comparing if they are the same pointer before comparing structural equality?In particular, if
main
above printsTrue
, does that mean thatx
andy
are both structurally equal and not infinite (and not bottom)?It depends on what types
T
containsThis statement is not true for
Data.Void
for example:so maybe it's true if you require
T
have a default derivingT
doesn't have anyVoid
s in it (or alternatively, rephrase the question to only be about non-bottom values)The type I was thinking when I asked the question was this one:
I think the answer should be yes then, because it fulfills the required criteria.