There is a widespread belief that seq / pseq functions cannot be defined in standard Haskell without extensions or primitive operations. But what is the difference between the behavior of the following functions (defined only by standard Haskell 98/2010) and their real counterparts?
data Seq a b = Seq !a !b
seq a b = case Seq a b of
Seq _ x -> x
data PSeq a b = PSeq !a b
pseq a b = case PSeq a b of
PSeq _ x -> x
For example, it is easy to verify that this definition satisfies
seq ⊥ x = ⊥
Some other simple experiments do not show the difference between these versions of seq / pseq and the real ones. So what's wrong?
source
share