Skip to content

Incorrect usage of the term "bang-pattern" in error message

Summary

Given the following module:

{-# LANGUAGE NoBangPatterns #-}
module Bang where

z = let !(x,y) = (1,2) in x

We get the following error message:

Bang.hs:4:9: error:
    Illegal bang-pattern (use BangPatterns):
    ! (x, y)
  |
3 | z = let !(x,y) = (1,2) in x
  |         ^^^^^^

which is incorrect; this is a strict binding, not a bang pattern.

My suggested error message:

Bang.hs:4:9: error:
    Illegal strict binding (use BangPatterns):
    ! (x, y)
  |
3 | z = let !(x,y) = (1,2) in x
  |         ^^^^^^

Tested with GHC 8.10.7 and 9.2.1.

In GHC HEAD the message is slightly different but still uses the term "bang-pattern":

Bang.hs:4:9: error:
    Illegal bang-pattern
    !(x, y)
    Suggested fix: Perhaps you intended to use BangPatterns
  |
4 | z = let !(x,y) = (1,2) in x
  | 

OS: Manjaro Linux x86_64

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information