Unrecognised pragma [GHC-42044]

Flag: -Wunrecognised-pragmas
Enabled by default

GHC emits a warning whenever it encounters a pragma which it doesn’t recognize. In these cases it just ignores the pragma, which might not be what you want.

This can indicate a typo in the name of the pragma, in which case fixing the typo should make the warning go away. See the GHC User Guide for a list of supported pragmas.

Examples

Misspelled pragmas

Typos in pragma names leads to warnings being emitted. Fixing the typos makes the warnings go away.

Error Message

UnrecognisedPragmas.hs:1:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
    Unrecognised pragma: LANGUGE
    Suggested fix: Perhaps you meant ‘LANGUAGE’
  |
1 | {-# LANGUGE BangPatterns #-}
  | ^^^^^^^^^^^

UnrecognisedPragmas.hs:3:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
    Unrecognised pragma: OPTION_HUGS
    Suggested fix: Perhaps you meant ‘OPTIONS_HUGS’
  |
3 | {-# OPTION_HUGS #-}
  | ^^^^^^^^^^^^^^^

UnrecognisedPragmas.hs:9:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
    Unrecognised pragma: INLNE
    Suggested fix: Perhaps you meant ‘INLINE’
  |
9 | {-# INLNE x #-}
  | ^^^^^^^^^
UnrecognisedPragmas.hs
Before
{-# LANGUGE BangPatterns #-}
--       ^ missing A
{-# OPTION_HUGS #-}
--        ^ missing S
module UnrecognisedPragmas where

x :: Int
x = 42
{-# INLNE x #-}
--     ^ missing I

After
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_HUGS #-}
module UnrecognisedPragmas where

x :: Int
x = 42
{-# INLINE x #-}