Q:

How can I use annotations to customize HLint and mark my Haskell package as Safe?

In my package I have several annotations to help customize my use of hlint:
{-# ANN module ("HLint: ignore Use infix"::String) #-}
{-# ANN module ("HLint: ignore Use mappend"::String) #-}
{-# ANN module ("HLint: ignore Use fmap"::String) #-}
{-# ANN module ("HLint: error Redundant $"::String) #-}
{-# ANN module ("HLint: ignore Use ."::String) #-}

But when I try to mark my package as Safe with
{-# LANGUAGE Safe #-}

I get 
    • Annotations are not compatible with Safe Haskell.
      See https://ghc.haskell.org/trac/ghc/ticket/10826
    • In the annotation:
        {-# ANN module ("HLint: ignore Use ." :: String) #-}
   |
80 | {-# ANN module ("HLint: ignore Use ."::String) #-}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

while with the annotations removed, I can build and test as Safe without errors.
Is there an alternative way to customize Hlint that allows my package to be marked as Safe?

A:

Instead of using ANN pragmas, you can use either:
{-# HLINT ignore "Use mappend" #-}

or:
{- HLINT ignore "Use mappend" -}

The former will trigger a warning from GHC about an unknown pragma.
See also:
https://github.com/ndmitchell/hlint#ignoring-hints

