Skip to content

Strange strict-binding behavior

Summary

For some reason, when entering the following expression into ghci, it evaluates to ():

let !(p : q : _) = [2] in ()

I believe the correct behavior is a pattern-match failure, which I observe if:

  • the variables p and q are replaced with wildcards, or
  • 2 is replaced with 2 :: Int, or
  • I compile and run a whole program containing this expression

Environment

  • GHC versions used: 9.0.2, 9.2.5, 9.4.4, 9.6.0.20230111
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information