Missing space after exclamation mark `!` [GHC-95644]

The ! character can be used for multiple purposes:

If no space is placed between ! and the expression that follows it, this is interpreted as the last bullet; in expression contexts, the bang pattern is not allowed. The most likely case is that you wish to use ! as a binary operator, in which case a space is needed following it.

Examples

Missing space after exclamation `!`

There is no space after the exclamation mark character !.

Error Message

MissingSpaceBangPattern.hs:9:9: error: [GHC-95644]
    Bang pattern in expression context: !1
    Did you mean to add a space after the '!'?
  |
9 | f x = x !1
  |
MissingSpaceBangPattern.hs
Before
module MissingSpaceBangPattern where

(!) :: Int -> Int -> Bool
(!) a b = a == b

infixl 5 !

f :: Int -> Bool
f x = x !1
After
module MissingSpaceBangPattern where

(!) :: Int -> Int -> Bool
(!) a b = a == b

infixl 5 !

f :: Int -> Bool
f x = x ! 1